blueStar
blueStar

Reputation: 313

Firebase iOS SDK - Missing Database URL

Hi I get the following error that I have inherited from a previous developer. My app keeps crashing with the following :

2016-06-21 22:26:16.828 Drnk[3234:1081556] The default app has not been configured yet.
2016-06-21 22:26:16.832 Drnk[3234:1081556] *** Terminating app due to uncaught exception 'MissingDatabaseURL', reason: 'Failed to get FIRDatabase instance: FIRApp object has no databaseURL in its FirebaseOptions object.'
*** First throw call stack:

My App delegate has the following code:

 FIRApp.configure()

My controller where I call the database and the app crashes has the following code:

 var ref: FIRDatabaseReference!

self.ref = FIRDatabase.database().reference()

I have added the google-services-plist file to my project as instructed.

This all works with another app I am developing but I can't solve this.

Upvotes: 3

Views: 2338

Answers (4)

Mike Design
Mike Design

Reputation: 1

Download and replace the GoogleService-info.plist again since you have already registered the database in your account

Upvotes: 0

Lance Samaria
Lance Samaria

Reputation: 19592

This is how I fixed it here https://stackoverflow.com/a/65866188/4833705

I didn't want to add the same code twice and the comments are kinda long so someone might miss this.

Upvotes: 0

KevinS
KevinS

Reputation: 607

In your class define a var:

var ref: FIRDatabaseReference?

then in viewDidLoad

ref = FIRDatabase.database().reference()

Upvotes: 0

cicerod
cicerod

Reputation: 138

Make sure you're not calling FIRDatabase.database().reference() before viewDidLoad

Upvotes: 5

Related Questions