简体   繁体   English

尝试在 Firestore 上存储数据时应用程序崩溃

[英]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.

相关问题 我在尝试将数据从云 Firestore 带到我的 flutter 应用程序时遇到此错误 - I am getting this error while am trying to bring data from cloud firestore to my flutter app Firestore RecyclerView 应用在运行时崩溃 - Firestore RecyclerView app's crashing when run 尝试使用 firestore 运行我的应用程序时出错:尝试分配给只读属性 - getting an error while trying to run my app with firestore: Attempted to assign to readonly property 即使不尝试访问数据,Firestore 应用程序也会丢失或权限不足 - Firestore app gets missing or insufficient permissions even when not trying to access the data Flutter 当firestore中有数据时,firestore返回长度0 - Flutter firestore returns length 0 while there is data in firestore 如何在移动设备上本地存储来自 firestore 的数据? - How to store data from firestore locally on mobile? Firebase / Firestore如何存储用户数据 - Firebase / Firestore how to store user data 尝试从 Firestore 数据库代码获取实时数据时出错:“ERR_HTTP_HEADERS_SENT” - Error while trying to get realtime data from firestore database code: 'ERR_HTTP_HEADERS_SENT' 尝试将 csv 文件数据导入 Firestore - Trying to import csv file data to Firestore 试图从 firestore 获取数据但出现此错误 - trying to get data from firestore but getting this ERROR
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM