[英]How to update a document in firebase firestore using swift?
when i run the following code i get this error.当我运行以下代码时,我收到此错误。
['FIRESTORE INTERNAL ASSERTION FAILED: Invalid document reference. ['FIRESTORE 内部断言失败:文档参考无效。 Document references must have an even number of segments, but User has 1']
文档引用必须有偶数个段,但用户有 1']
func saveLabel(uid: String, label: String){
let userRef = db.collection("User").document(uid)
userRef.updateData(["label": label]) { (error) in
if error == nil {
print("updated")
}else{
print("not updated")
}
}
}
This error almost certainly means that uid
is empty.这个错误几乎肯定意味着
uid
为空。 You should log it to make sure.你应该记录它以确保。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.