调用FIRApp.configure()后未配置iOS Firebase应用程序

jth*_*man 2 ios firebase firebase-realtime-database

我有一个iOS(Swift)应用程序,AppDelegate中包含以下代码:

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

该应用程序崩溃persistenceEnabled = true,有异常FIRAppNotConfigured和消息"Failed to get default FIRDatabase instance. Must call FIRApp.configure() before using FIRDatabase."

显然,我之前已经打过电话FIRApp.configure(),所以建议的解决方案是不正确的.日志输出甚至显示"Configuring the default app"何时调用.

可能是什么问题,我如何解决它,以便我可以使用FIRDatabase?

Dra*_*ian 11

尝试:

override init() {
   // Firebase Init
   FIRApp.configure()
}
Run Code Online (Sandbox Code Playgroud)