jthurman
jthurman

Reputation: 465

iOS Firebase app not configured after calling FIRApp.configure()

I have an iOS (Swift) app with the following code in the AppDelegate:

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

The app crashes on the persistenceEnabled = true line, with exception FIRAppNotConfigured, and the message "Failed to get default FIRDatabase instance. Must call FIRApp.configure() before using FIRDatabase."

Obviously, I've called FIRApp.configure() immediately before this, so the suggested solution is incorrect. The log output even shows "Configuring the default app" when that is called.

What might the problem be, and how could I resolve it so I can use the FIRDatabase?

Upvotes: 3

Views: 2750

Answers (1)

Dravidian
Dravidian

Reputation: 9945

Try:

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

Upvotes: 13

Related Questions