Use different GoogleService-Info.plist for different build schemes

后端 未结 17 766
梦毁少年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:29

    With Xcode 9.2, I have needed files for both targets to be named "googleServiceInfo.plist" but placed in different directories, with the directory/file for each target specified in "Build Phases", "Copy Bundle Resources".

    The above was not my preferred solution, but I had previously tried using different filenames along the lines of @inidona's answer, converted to Swift 4:

     let filePath = Bundle.main.path(forResource: "googleServiceInfo-Pro", ofType: "plist")!
     let options = FirebaseOptions(contentsOfFile: filePath)
     FirebaseApp.configure(options: options!)
    

    Unfortunately, this did not correct the Firebase error messages. In this question: Firebase iOS SDK - Using configuration file other than GoogleService-Info.plist generates console warning the original poster seems to have fixed by updating the Firebase Pod but I have not confirmed this.

提交回复
热议问题