多个GoogleService-Info支持

pa1*_*a12 4 ios firebase

我将我的Dev和Prod计划注册为Firebase中的不同应用程序.我希望它们是分开的,每个都有唯一的捆绑ID.我正在使用#if dev来确定它是dev还是prod方案.如何使用专用的plist为该方案初始化firebase?

Leo*_*nte 5

只需使用[FIRApp configureWithOptions:]

NSString *firebasePlist = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];

#if STAGING
    firebasePlist = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info-DEV" ofType:@"plist"];
#endif

FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:firebasePlist];
[FIRApp configureWithOptions:options];
Run Code Online (Sandbox Code Playgroud)