In new Firebase, how to use multiple config file in xcode?

后端 未结 9 1484
被撕碎了的回忆
被撕碎了的回忆 2021-01-30 09:14

Hey I am playing with the new firebase iOS SDK, in my project, I have only one target, I created two configurations, Debug and Release, with different bundler identifier, but se

9条回答
  •  花落未央
    2021-01-30 09:44

    Better approach if you have single target is to just name your configs appropriately and load them as below. Seems to work fine for UAT environment example : Swift 3.0

        var fireBaseConfigFile = Bundle.main.path(forResource: "GoogleService-Info-PROD", ofType: "plist")
       #if UAT
           fireBaseConfigFile = Bundle.main.path(forResource: "GoogleService-Info-UAT", ofType: "plist")
       #endif
    
       guard let firOptions = FIROptions(contentsOfFile: fireBaseConfigFile) else {
           assert(false, "Failed to load Firebase config file")
           return
       }
    
       FIRApp.configure(with: firOptions)
    

提交回复
热议问题