Please help. After migrating to new Firebase I can\'t retrieve data. Use this construction:
let ref = FIRDatabase.database().reference()
override func viewDidL
To build on the answer given by @ColdLogic, the reason I had this error was because I had my Firebase database reference being created in an init method on a view controller, not in the viewDidLoad method. Since the init methods for all classes that are instantiated when the app launches are called before the application:DidFinishLaunchingWithOptions method in the AppDelegate, it was causing this crash. Moving this line of code:
class MyViewController {
var firebaseRef: FIRDatabaseReference
required init?(coder aDecoder: NSCoder) {
...
firebaseRef = FIRDatabase.database().reference()
}
override func viewDidLoad() {
...
}
}
to here:
class MyViewController {
var firebaseRef: FIRDatabaseReference
required init?(coder aDecoder: NSCoder) {
...
}
override func viewDidLoad() {
...
self.firebaseRef = FIRDatabase.database().reference()
}
}
solved the problem for me.