I have an issue with access to Firebase Firestore from my MacOs Application (SwiftUI).
All requirements are provided by my app like:
- google.plist (bundle id, Firestore url etc are correct)
- keychain access
- incoming and outgoing connections
but stil when I try to setValue
to my Firestore database I receive an error like so:
10.19.0 – [FirebaseDatabase][I-RDB034005] Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Firebase error. Please ensure that you have the URL of your Firebase Realtime Database instance configured correctly.
code to add a simple value looks like that:
Database.database().reference().child("test").setValue(["test": 123])
The method to initiate Firebase is located in AppDelegate:
final class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ notification: Notification) {
UserDefaults.standard.register(defaults: ["NSApplicationCrashOnExceptions" : true])
FirebaseApp.configure()
}
}
do you have any idea what is missing here?
2
Answers
The code:
is for Firebase Realtime Database (RTDB), not Firestore.
The error message is likely due to the fact that you have not initialized the RTDB service in your project…but if you are trying to use Firestore then don’t use RTDB code nor its service.
First of all the code you are using it is not firestore . it is for firebase realtime database .
to solve the error try this code for initialization DB
hope it helps .