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

后端 未结 9 1482
被撕碎了的回忆
被撕碎了的回忆 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:20

    The latest syntax is here to configure firebase for 2 targets (2 Plist files)

    func configureFirebase() {
            let firebasePlistFileName = ConfigurationManager.sharedManager().firebasePlistName()
            if let path = Bundle.main.path(forResource: firebasePlistFileName, ofType: "plist") {
                if let firbaseOptions = FirebaseOptions(contentsOfFile: path) {
                    FirebaseApp.configure(options: firbaseOptions)
                }
            }
        }
    

    firebasePlistFileName variable is just fetching the PList name based on current configuration i.e. Development or Production.

提交回复
热议问题