2016-09-16 198 views
2

我有一個的iOS(SWIFT)應用程序與所述的AppDelegate以下代碼:iOS的火力地堡應用FIRApp.configure()

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
    FIRApp.configure() 
    FIRDatabase.database().persistenceEnabled = true 
    return true 
} 

persistenceEnabled = true線的應用崩潰,與異常FIRAppNotConfigured,和消息"Failed to get default FIRDatabase instance. Must call FIRApp.configure() before using FIRDatabase."

顯然,我在此之前立即調用了FIRApp.configure(),所以建議的解決方案不正確。當被調用時,日誌輸出甚至顯示"Configuring the default app"

問題可能是什麼,我怎麼解決它,所以我可以使用FIRDatabase?

回答

8

嘗試:

override init() { 
    // Firebase Init 
    FIRApp.configure() 
} 
+0

先生,您值得數百萬個點 – JamesG