The default app has not been configured yet

后端 未结 9 1619
予麋鹿
予麋鹿 2020-12-02 19:59

I\'m trying to upgrade my app to the new version of Firebase. I went through the setup guide and edited all of my code to match the new syntax. However, when I run the app,

9条回答
  •  一个人的身影
    2020-12-02 20:54

    I had several normal working projects with FIRApp.configure () code in AppDelegate.swift:

    class AppDelegate: UIResponder, UIApplicationDelegate {
    
        var window: UIWindow?
    
    
        func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
            FIRApp.configure()
            return true
        }
    

    Everything worked great for quite some time, but yesterday and today I opened a Swift 3 project inside my Xcode 7.3.1 (I am still working in Swift 2, but opened Swift 3 project to see what is changed), and suddenly in all my Swift 2 apps and projects that I am still working on, got the same error:

    The default app has not been configured yet

    Every project now when I open in XCode, getting same error, I didn't know what to do, but after implementing @MichaelWilliams' code, everything works fine again.

    I have debug my Xcode (clear and reload console), but nothing works beside this new approach by Michael.

    This one resolved my problem:

    override init() {
       FIRApp.configure()
       FIRDatabase.database().persistenceEnabled = true
    }
    

    Can this new code somehow make my app's unstable and can I be afraid to see problems with connecting/working with Firebase database now?

提交回复
热议问题