Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not Reach Firestore Backend

I'm creating a swift 4 ios application and would like to use Firestore to store all my data. I've gone through the getting started guides and watched the online tutorial, but I continue to get the error:

"4.8.1 - [Firebase/Firestore][I-FST000001] Could not reach 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 (have 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 the error

"4.8.1 - [Firebase/Firestore][I-FST000001] Could not reach Firestore backend."

I have my firestore set to test mode so all reads and writes should be allowed. Anyone of ideas as to why I can't connect to the backend?

like image 488
Cameron Korb Avatar asked Jan 19 '18 21:01

Cameron Korb


People also ask

Is firestore a backend?

Cloud Firestore ships with mobile and web SDKs and a comprehensive set of security rules so you can access your database without needing to stand up your own server. Using Cloud Functions , our serverless compute product, you can execute hosted backend code that responds to data changes in your database.


1 Answers

In my case, I was trying to add data into "Real-Time Database" of Firebase Console and then read in my new AngularFire2 app. Realized after a while that it has to be "Cloud Firestore".

like image 98
Rohith Doraiswamy Avatar answered Oct 20 '22 18:10

Rohith Doraiswamy