How can I separate testing and production data in my Firebase Database?

前端 未结 1 845
花落未央
花落未央 2021-02-12 10:58

Each Firebase project includes only one JSON tree for data. Best practices dictate that tests should be run on a separate database from production data. What is the simplest way

相关标签:
1条回答
  • 2021-02-12 11:23

    Create multiple Firebase projects. Each project has its own plist file.

    FIRApp has a custom configuration option. Download the plist for your testing/debug project, rename it and load like below.

    #if DEBUG
        NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-dev" ofType:@"plist"];
        FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
        [FIRApp configureWithOptions:options];
    #else
        [FIRApp configure];
    #endif
    

    A more detailed explanation can be found here

    0 讨论(0)
提交回复
热议问题