ios - 我的代码中出现“线程执行断点”问题,试图将文档添加到 firestore 子集合中
问题描述
我正在尝试通过函数将文档添加到在我的 firestore 数据库中找到的文档的子集合中。但不幸的是,它会导致线程执行错误,我显然无法说出问题所在。
我在其他此类函数中使用了相同的方法,使用文档唯一 ID 作为对特定文档的引用点。但我不知道为什么这种特殊情况会出错
代码错误:
func addComment(from data:[String:Any], completion: @escaping (Bool) -> ()){
db.collection("Events").document((event?.uid)!).collection("Comments").addDocument(data: data) { (error) in // This line causes Thread Breakpoint
if error != nil {
print(error?.localizedDescription)
return
}
}
completion(true)
}
解决方案
推荐阅读
- mapbox - 如何在 mapbox 中按邮政编码组构建自定义区域和填充颜色?
- svn - 阻止用户在 SVN 中编辑本地工作副本
- c# - 使用表达式从属性中获取自定义属性
- javascript - React Context API 和生命周期方法 - 如何一起使用
- javascript - 在给定的函数中使用 JavaScript 包含函数或任何好的替代方法而不是 endsWith
- api - 在亚马逊附属产品 API 中获取问题以从亚马逊获取产品
- arrays - 用数组过滤数组
- swift - 无法在属性初始化程序中使用实例成员“form_Mesaj1”;属性初始化程序在“自我”可用之前运行
- android - 为什么我在 Android Studio 的当前项目中会显示来自不同项目的应用模块?
- java - JTABLE,当我清除所有行时,如果选择了一个,那一个仍然出现在那里