[英]App crashing while trying to store data on Firestore
App Crashing with error:应用崩溃错误:
FIRESTORE INTERNAL ASSERTION FAILED: Invalid document reference. FIRESTORE 内部断言失败:文档引用无效。 Document references must have an even number of segments, but users_table has 1文档引用必须有偶数个段,但 users_table 有 1
I am trying to store like this:-我正在尝试这样存储:-
func updateFirestorePushTokenIfNeeded() {
if let token = Messaging.messaging().fcmToken {
let usersRef = Firestore.firestore().collection("users_table").document(userID)
usersRef.setData(["fcmToken": token], merge: true)
}
}
My firestore is empty right now.我的 firestore 现在是空的。
That error message almost certainly means that userID
is nil or empty.该错误消息几乎肯定意味着userID
为 nil 或为空。 You should verify that you're passing the correct values to Firestore.您应该验证您是否将正确的值传递给 Firestore。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.