My iOS app uses two Firebase configuration files, one for development and one for production. How can I switch between the two during runtime? When I attempt the switch with [FIRApp configureWithOptions:options];
, I get the error:
Default app has already been configured.
So I have tried to clear the current config [FIRApp deleteApp]
before switching to the other config, however the deleteApp
method is a private method and is not accessible.
答案 0 :(得分:1)
初始化firebase时尝试此操作:
NSString *filePath;
#ifdef DEBUG
filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-Debug" ofType:@"plist"];
#else
filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-Live" ofType:@"plist"];
#endif
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
[FIRApp configureWithOptions:options];
答案 1 :(得分:1)
我错误地调用了deleteApp
方法。它应该在defaultApp
上调用,例如:
[[FIRApp defaultApp] deleteApp:^(BOOL success) { ... }];