嗨,我正在玩新的firebase iOS SDK,在我的项目中,我只有一个目标,我创建了两个配置,Debug和Release,具有不同的bundler标识符,但是似乎从firebase下载的配置文件只支持一个bundle标识符.
所以任何人都知道如何在多个包标识符xcode项目中使用firebase?
谢谢!
解决方法
我的第一个尝试没有解决问题:
我将第二个GoogleService-Info.json重命名为其他内容,并使用以下代码从AppDelegate配置Firebase.
// Swift code #if STAGING let firebasePlistFileName = "GoogleService-Staging-Info" #else let firebasePlistFileName = "GoogleService-Info" #endif let firbaseOptions = FIROptions(contentsOfFile: NSBundle.mainBundle().pathForResource(firebasePlistFileName,ofType: "plist")) FIRApp.configureWithOptions(firbaseOptions)
如果我运行Staging目标,我将收到Firebase关于“无法找到配置文件:”GoogleService-Info.plist“的投诉.但是,它说“Firebase Analytics v.3300000已启动”.
当我在Firebase仪表板上检查时,生产和分段应用程序都会记录传入的用户事件.
上面提到的configureWithOptions方法没有记录在Firebase文档中,我通过检查它的源代码来计算出来.我不知道这可能是什么不利的.我很乐意听到其他方法.
更新了一个更容易的解决方案:
1. keep the same names for both GoogleService-Info.plist 2. put one GoogleService-Info.plist inside a subfolder,say "staging" 3. add references to both files in Xcode,while link them to corresponding targets 4. just use FIRApp.configure() in your AppDelegate,done
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。