Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 249
jthurman Avatar asked Dec 30 '25 21:12

jthurman


1 Answers

Try:

override init() {
   // Firebase Init
   FIRApp.configure()
}
like image 172
Dravidian Avatar answered Jan 02 '26 12:01

Dravidian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!