Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Realtime on iOS: Cannot access Realtime Database

I am getting the following error:

[Firebase/Database][I-RDB034005] Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Firebase error. Please ensure that you spelled the name of your Firebase correctly

Permissions on admin console are set .read and .write to false

I understand the error. when I run the following command and print the value of variable:

Database.database().reference()

I get (cant edit it):

https://bananas-31fe5-default-rtdb.firebaseio.com

And on admin console I have (cant edit it):

https://bananas-31fe5-default-rtdb.europe-west1.firebasedatabase.app

On admin console, I tried creating a new database (and disabling the primary one) on the US, but the one on xcode doesnt seem to change.

My gut feeling is this has to do with the pod library not being updated to enable multiple db location (EU is in beta).

like image 494
Inigo Llamosas Avatar asked Dec 09 '20 14:12

Inigo Llamosas


People also ask

Does Firebase work with iOS?

Go to the Firebase console. In the center of the project overview page, click the iOS+ icon to launch the setup workflow. If you've already added an app to your Firebase project, click Add app to display the platform options. Enter your app's bundle ID in the bundle ID field.

What are the Realtime Database limits in Firebase?

256 MB from the REST API; 16 MB from the SDKs. The total data in each write operation should be less than 256 MB. Multi-path updates are subject to the same size limitation. The total bytes written through simultaneous write operations on the database at any given time.

How do I check my Firebase Realtime Database?

To see your current Realtime Database connections and data usage, check the Usage tab in the Firebase console. You can check usage over the current billing period, the last 30 days, or the last 24 hours.


2 Answers

firebaser here

For non-US-central databases the SDK may not be able to read the information from the plist file, so you have to pass it in the code.

You can pass the database URL into the call to database, like:

Database.database("https://bananas-31fe5-default-rtdb.europe-west1.firebasedatabase.app").reference()

See docs for that method override.

like image 181
Frank van Puffelen Avatar answered Oct 20 '22 23:10

Frank van Puffelen


When you create a realtime database for the first time, DATABASE_URL is added to your GoogleService-Info.plist file on the server side. You may be getting an error because the GoogleService-Info.plist is outdated and does not contain DATABASE_URL. You can download your updated GoogleService-Info.plist file from your Project Settings and try again.

I hope it helped

like image 38
perpeer Avatar answered Oct 20 '22 22:10

perpeer