Got You must call FIRApp.configure () before using FIRDatabase. mistake though i already called it

I got 'Must call FIRApp.configure () before using the FIRDatabase error, although I already called it in' Appdelegate.swift '. This is my application delegate.

+4
source share
1 answer

First decision :

If you use FIRDatabase.database().reference()in your ViewController, share the code with us. If you use something like this:

var db = FIRDatabase.database().reference()

before viewDidLoad you can get this error. Better do this:

var db: FIRDatabaseReference!

override func viewDidLoad() {
    super.viewDidLoad()
    db = FIRDatabase.database().reference()
}

, configure() finishLaunchingWithOptions, .

:

AppDelegate.swift :

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

init() FireBase, .

+13

All Articles