我一直试图让FireStore在Swift上运行,但是进入" FIRAuth getUID实现并没有设置。"我无法获取我的数据。我开始使用Test app ...全新的Firestore项目。 Swift中的新iOS项目。新的一切。我只是想读一些数据。这就是我到目前为止......
xCode版本9.3(9E145) FireStore规则
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write;
}
}
}
import UIKit
import Firebase
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
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.
}
注意:将Firebase添加到您的iOS APP。 第5步...运行您的应用以验证安装 check_circle恭喜,您已成功将Firebase添加到您的应用中! 所以我知道应用正确连接。
===========================
所以我转到FireStore文档: https://firebase.google.com/docs/firestore/quickstart
我将此代码添加到ViewCOntroller.swift。
导入UIKit 导入Firebase class ViewController:UIViewController {
覆盖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)")
}
}
}
我得到了这个错误......
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;
}}
=========================================
我怀疑是有一个Auth问题,但我的规则是敞开的。我完全遵循了指示。我得到了一些我必须拥有某种Auth证书。
也就是说,最终,我想要做的就是从这个网站读取数据。
所以,有什么想法,我做错了吗?
==============================================
`===============================
===== btn READDATA ======= 获取文档时出错:Error Domain = FIRFirestoreErrorDomain Code = 13"发生内部错误。" UserInfo = {NSLocalizedDescription =发生内部错误。}
===== btn POSTDATA ======= 添加文档时出错:Error Domain = FIRFirestoreErrorDomain Code = 7"权限丢失或不足。"的UserInfo = {io.grpc.HeadersKey = { " ALT-SVC" =" hq = \":443 \&#34 ;; MA = 2592000; QUIC = 51303433; QUIC = 51303432; QUIC = 51303431; QUIC = 51303339; QUIC = 51303335,QUIC = \":443 \&#34 ;; MA = 2592000; V = \" 43,42,41,39,35 \"&#34 ;; "内容处置" =附件; date =" Mon,30 Apr 2018 16:01:01 GMT&#34 ;; },NSLocalizedDescription =权限丢失或不足。,io.grpc.TrailersKey = { "内容处置" =附件; }}`
答案 0 :(得分:1)
我解决了这个问题。我的Cocoa Pods需要更新。实际上我做了一个全新的Cocoapds安装,但如果你有这个问题,我建议你做一个pod更新。就那么简单。 是的,这是一个愚蠢的错误,但我要感谢那些让我失望的海报。