Firebase iOS SDK-使用除GoogleService-Info.plist以外的配置文件会生成控制台警告 [英] Firebase iOS SDK - Using configuration file other than GoogleService-Info.plist generates console warning
问题描述
我正在使用Firebase 3.x SDK运行一个应用程序,并希望有条件地使用不同的配置.plist来指向不同的Firebase位置,具体取决于该应用程序是针对开发还是生产而配置的.
I am running an app with the Firebase 3.x SDK, and looking to conditionally use a different configuration .plist to point to a different Firebase location depending on whether the app is configured for development vs production.
我正在尝试使用FIRApp的 configureWithOptions
来完成此操作,在这里我为作为参数传递的 FIROptions
设置了不同的plist路径.但是,当我使用"GoogleService-Dev-Info.plist"之类的路径时,我从Firebase/Core收到控制台警告,提示找不到"GoogleService-Info.plist".我看到 FIROptions
对象的所有属性都填充了我从GoogleService-Dev-Info.plist文件中获得的期望值,所以我不确定我不了解的内容.无论传入的是什么选项,Firebase SDK中都有一些硬编码可以转到GoogleService-Info.plist吗?
I am trying to use FIRApp's configureWithOptions
to accomplish this, where I set a different plist path for the FIROptions
that I pass as a parameter. However, when I use a path to something like "GoogleService-Dev-Info.plist" I get a console warning from Firebase/Core that states "GoogleService-Info.plist" could not be found. I see that all of the properties of the FIROptions
object are populated with what I would have expected out of my GoogleService-Dev-Info.plist file, so I'm not sure what I'm not understanding. Is there something hardcoded in the Firebase SDK to go to GoogleService-Info.plist regardless of any options passed in?
推荐答案
如果其他人也有同样的疑问,则下面是Swift 3中的代码示例:
If someone else has the same doubt, a code example in Swift 3 is below:
let firebaseOptions = FirebaseOptions(contentsOfFile: Bundle.main.path(forResource: "GoogleService-Dev-Info", ofType: ".plist")!)
FirebaseApp.configure(options: firebaseOptions!)
这篇关于Firebase iOS SDK-使用除GoogleService-Info.plist以外的配置文件会生成控制台警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!