xcode Firebase:FIRApp.configure() 一直想让我把它改成 FirebaseApp.configure()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44117946/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Firebase: FIRApp.configure() keeps wanting me to change it to FirebaseApp.configure()
提问by HappyMouse
So I made a project that included lots of extra code so I could try out different things, and I am slowly copy-pasting the files from textedit into my new project.
所以我做了一个包含大量额外代码的项目,这样我就可以尝试不同的东西,我正在慢慢地将 textedit 中的文件复制粘贴到我的新项目中。
I created a new Firebase account, added the google plist file, initialized and installed the pods needed (also changed the iOS version to 10.0 on the pod file)... yet it's still wanting me to use FirebaseApp.configure() instead of FIRApp.configure().
我创建了一个新的 Firebase 帐户,添加了 google plist 文件,初始化并安装了所需的 pod(也在 pod 文件上将 iOS 版本更改为 10.0)......但它仍然希望我使用 FirebaseApp.configure() 而不是 FIRApp 。配置()。
Should I just delete the whole thing and try again? I just created a new Xcode project, so if I had to delete it right now that would be fine.
我应该删除整个内容并重试吗?我刚刚创建了一个新的 Xcode 项目,所以如果我现在必须将其删除,那就没问题了。
import UIKit
import Firebase
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
override init() {
super.init()
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FIRApp.configure()
return true
}
There hasn't been much code written, but I can't figure out what could have made this happen... especially since I just started the new project.
没有写多少代码,但我无法弄清楚是什么导致了这种情况发生......尤其是因为我刚刚开始新项目。
回答by Jen Person
FirebaseApp.configure()
is correct. I checked out the documentationjust now and FIRApp.configure()
has been renamed FirebaseApp.configure()
. I also ran pod update
on one of my projects just to confirm, and my project had me change to using FirebaseApp.configure()
. So no need to rebuild!
FirebaseApp.configure()
是正确的。刚才查了一下文档,FIRApp.configure()
已经改名了FirebaseApp.configure()
。我还运行pod update
了我的一个项目只是为了确认,我的项目让我改为使用FirebaseApp.configure()
. 所以不需要重建!
回答by K-A
I can confirm that FIRApp.configure()
can be changed to FirebaseApp.configure()
我可以确认FIRApp.configure()
可以更改为FirebaseApp.configure()
回答by K-A
In firebase it suggest to add the following to app delegate:
在 firebase 中,它建议将以下内容添加到应用程序委托中:
"
import UIKit import Firebase
@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure()return true } }
"
”
导入 UIKit 导入 Firebase
@UIApplicationMain 类 AppDelegate: UIResponder, UIApplicationDelegate {
变量窗口:UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { FirebaseApp.configure()return true } }
”
This includes the FirebaseApp.configure()command
这包括FirebaseApp.configure()命令