multiple GoogleService-Info support

前端 未结 2 2015
别跟我提以往
别跟我提以往 2020-12-11 21:31

I registered my Dev and Prod schemes as different apps in Firebase. I want them to be separate, Each has unique bundle ID. I am using #if dev to identify if it is dev or pro

相关标签:
2条回答
  • 2020-12-11 21:38

    use

    var firebasePlist: String? = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist")
    if development == true{
    firebasePlist = Bundle.main.path(forResource: "GoogleService-Info-DEV", ofType: "plist")
    }
    var options = FIROptions(contentsOfFile: firebasePlist)
    FIRApp.configure(with: options)
    

    but you'll have to have a variable called development with the value of true when you want to use the DEV GoogleService plist and the value of false is you want to use the regular GoogleService plist

    0 讨论(0)
  • 2020-12-11 21:58

    Just use [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];
    
    0 讨论(0)
提交回复
热议问题