I have been trying to get FireStore to work on Swift, but running into "FIRAuth getUID implementation wasn't set." and I cannot get to my data. I started with a Test app... completely new Firestore project. New iOS project in Swift. New Everything. I just want to read some data. THis is what I have so far...
xCode Version 9.3 (9E145) FireStore rules
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write;
}
}
}
AppDeligate.swift
import UIKit
import Firebase
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
ViewController.swift
import UIKit
import Firebase
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let db = Firestore.firestore()
// this gives
// [Firebase/Core][I-COR000025] FIRAuth getUID implementation wasn't set.
// and I cant read data after ward.
}
NOTE: Add Firebase to your iOS APP. Step 5...Run your app to verify installation check_circle Congratulations, you've successfully added Firebase to your app! So I know the app is connecting properly.
===========================
So I goto the FireStore docs at: https://firebase.google.com/docs/firestore/quickstart
I add this code to ViewCOntroller.swift .
import UIKit import Firebase class ViewController: UIViewController {
override func viewDidLoad() { super.viewDidLoad()
let db = Firestore.firestore()
// this gives
// [Firebase/Core][I-COR000025] FIRAuth getUID implementation
wasn't set.
// and I cant read data after ward.
// Add a new document with a generated ID
var ref: DocumentReference? = nil
ref = db.collection("users").addDocument(data: [
"first": "Ada",
"last": "Lovelace",
"born": 1815
]) { err in
if let err = err {
print("Error adding document: \(err)")
} else {
print("Document added with ID: \(ref!.documentID)")
}
}
}
And I get this error...
2018-04-30 09:17:34.410768-0400 t5[32887:825090] 4.10.0 -
[Firebase/Core][I-COR000025] FIRAuth getUID implementation wasn't
set.
2018-04-30 09:17:34.625631-0400 t5[32887:825100] TIC Read Status
[1:0x0]: 1:57
2018-04-30 09:17:34.625748-0400 t5[32887:825100] TIC Read Status
[1:0x0]: 1:57
==============================================
Error adding document: Error Domain=FIRFirestoreErrorDomain Code=7
"Missing or insufficient permissions." UserInfo={io.grpc.HeadersKey={
"alt-svc" = "hq=\":443\"; ma=2592000; quic=51303433;
quic=51303432; quic=51303431; quic=51303339;
quic=51303335,quic=\":443\"; ma=2592000; v=\"43,42,41,39,35\"";
"content-disposition" = attachment;
date = "Mon, 30 Apr 2018 13:17:35 GMT";
}, NSLocalizedDescription=Missing or insufficient permissions.,
io.grpc.TrailersKey={
"content-disposition" = attachment;
}}
=========================================
My suspicion is that there is an Auth Issue, but I have my rules set to wide open. I followed instruction perfectly. I get the sence that I have to have some sort of Auth certificate.
That said, ultimately, all I want to do is read data from this site.
So, any thoughts out there what I am doing wrong?
==============================================
I added more Post data and Read Data . and still getting...
`===============================
=====btn READDATA ======= Error getting documents: Error Domain=FIRFirestoreErrorDomain Code=13 "An internal error occurred." UserInfo={NSLocalizedDescription=An internal error occurred.}
2018-04-30 12:01:00.004048-0400 t6[342:28839] Status bar could not find cached time string image. Rendering in-process.
=====btn POSTDATA ======= Error adding document: Error Domain=FIRFirestoreErrorDomain Code=7 "Missing or insufficient permissions." UserInfo={io.grpc.HeadersKey={ "alt-svc" = "hq=\":443\"; ma=2592000; quic=51303433; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=\":443\"; ma=2592000; v=\"43,42,41,39,35\""; "content-disposition" = attachment; date = "Mon, 30 Apr 2018 16:01:01 GMT"; }, NSLocalizedDescription=Missing or insufficient permissions., io.grpc.TrailersKey={ "content-disposition" = attachment; }}`
I resolved the issue. My Cocoa Pods needed updating. Actually I did a completely new install of Cocoapds, but I recommend doing a pod update if you have this issue. Simple as that. yes it was a stupid mistake, but I would like to thank the poster that down gradded me.