Could not reach Firestore Backend

I am creating a fast ios 4 application and want to use Firestore to store all my data. I went through the initial tutorials and looked at the online tutorial, but I keep getting the error:

"4.8.1 - [Firebase / Firestore] [I-FST000001] Failed to reach the Firestore backend."

my cocoapods file contains:

pod 'Firebase/Core' pod 'Firebase/Auth' pod 'Firebase/Firestore' 

In AppDelegate : I import Firebase and in didFinishLaunchingWithOptions I do FirebaseApp.configure()

In viewController: import Firebase (also tried import FirebaseFirestore )

I define:

 var docRef : DocumentReference! 

and in viewDidLoad:

 docRef = Firestore.firestore().document("test/test") docRef.getDocument { (docSnapshot, error) in guard let docSnapshot = docSnapshot, docSnapshot.exists else {return} let myData = docSnapshot.data() let val = myData!["name"] as? integer_t ?? 1 print(val) } 

and I get an error

"4.8.1 - [Firebase / Firestore] [I-FST000001] Failed to reach the Firestore backend."

I have a firestore set to test mode, so all reads and writes must be allowed. Any of the ideas on why I cannot connect to the server?

+6
source share
4 answers

In my case, I tried to add data to the "real-time database" of the Firebase console, and then read it in my new AngularFire2 application. After some time, I realized that this should be a "Cloud Firestore".

+1
source

First you need to get a link to the collection containing this document, try:

 let docRef = db.collection("test").document("test") docRef.getDocument { (document, error) in if let document = document { print("Document data: \(document.data())") } else { print("Document does not exist") } } 
0
source

The problem was resolved when I "reset all content and settings" on the simulator.

0
source

It may be too late, but I just solved this problem, and it was difficult for me to find the answer, so I share it. You must be logged in first and the problem will be resolved. The code below is an example to login with an anonymous user. Hope this is helpful for you.

 Auth.auth().signInAnonymously { (result, error) in print("result:\(result) " ) print("error: \(error)") } 

see https://firebase.google.com/docs/auth/ios/custom-auth.

0
source

Source: https://habr.com/ru/post/1274825/


All Articles