Search code examples
objective-cfirebase-realtime-databasensurl

where to provide NSURL value?


Every time I run the app it crashes and the console says:

Terminating app due to uncaught exception 'MissingDatabaseURL', reason: 'Failed to get FirebaseDatabase instance: Specify DatabaseURL within FIRApp or from your databaseForApp:URL: call.

I have the URL I don't know where to place it. I am new to objective C. This is the line that firebase say to use I Just don't know where to place the value of url.

+ (FIRDatabase *)databaseForApp:(FIRApp *)app URL:(NSString *)url 

Solution

  • It looks like the GoogleServices-Info.plist file that you downloaded from Firebase does not contain the URL for the database.

    There are a few reasons this could be happening:

    • If you are providing the configuration data in code, be sure to set the databaseURL property to the correct value.

    • If you are providing the configuration data through the GoogleServices-Info.plist file, be sure to download a new version of that file after you create the database in the Firebase console and add it to your app as before.

    This is a new requirement (since a few weeks ago) as the Realtime Database is now created on-demand (instead of auto-created when the project is created), so that you can pick in what region it's created.

    Also see, this question/answer for Android: Firebase : I get in trouble when I sign in with Google