Use different GoogleService-Info.plist for different build schemes

后端 未结 17 728
梦毁少年i
梦毁少年i 2020-12-07 07:49

I am using a build scheme for prod and one for staging (with 2 different bundle identifiers) and I am trying to use a separate GoogleService-Info.plist for each scheme. Is t

17条回答
  •  一生所求
    2020-12-07 08:43

    I solved this by this:

        #if STAGING
            if let filePath = Bundle.main.path(forResource: "GoogleService-Info-Dev", ofType: "plist"),
                let options = FirebaseOptions(contentsOfFile: filePath) {
                    FirebaseApp.configure(options: options)
            } else {
                fatalError("GoogleService-Info-Dev.plist is missing!")
            }
        #else
            if let filePath = Bundle.main.path(forResource: "GoogleService-Info", ofType: "plist"),
                let options = FirebaseOptions(contentsOfFile: filePath) {
                    FirebaseApp.configure(options: options)
            } else {
                fatalError("GoogleService-Info.plist is missing!")
            }
        #endif
    

提交回复
热议问题