0

我有一个 Firestore 数组,其中包含输入用户(作为 ID)。我的目标是在应用程序终止时从该聊天中删除当前用户。我已经阅读了这个线程,Frank van Puffelen 说您可以使用以下代码删除断开连接时的值:

ref.child("Clients").child(user.uid).child("current_venue").onDisconnectRemoveValue()

我的问题是这段代码只能从数据库中删除一个子文档,而不是一个数组。有什么方法可以调用onDisconnectRemoveValue()Firestore 阵列吗?或者这种情况有什么替代方案吗?

这是我的数据库结构的样子: Collection(Chats) -> Document( ChatID ) -> Array(typingUsers)

4

1 回答 1

0

您可以在函数下的 appDelegate 中从 firebase 中删除所需的任何值:

func applicationWillTerminate(_ application: UIApplication) {
    // Remove the array
}
于 2022-01-01T07:51:27.503 回答