swift - Firestore 中的 updateData() 函数存在问题
问题描述
这是我在 Firestore 数据库中更新字段的代码:
private var db = Firestore.firestore()
func moveToNextWeek(){
let newWeekOn = plan!.weekOn + 1
db.collection("Users").document(Auth.auth().currentUser!.uid).collection("Plan").document("plan").updateData(["weekOn": newWeekOn])
}
但是我不断收到错误:Ambiguous use of 'updateData'
. 我不明白为什么这个错误不断出现,有什么想法吗?
解决方案
可以通过将其分配给变量并添加来修复它.description
。
let _ = db.collection("Users").document(Auth.auth().currentUser?.uid ?? "NO USER").collection("Plan").document("plan").updateData(["weekOn": newWeekOn]).description
但是,我不确定为什么会这样。
推荐阅读
- javascript - 变量和字符串的函数参数问题
- c++ - 无法设置扫描仪功能,因为 L_TwainStartCapsNeg 返回错误 -84
- android - android:onClick 属性定义在视图类 androidx.appcompat.widget.AppCompatButton
- c# - Rerun failed tests using Specflow.Retry
- node.js - 服务帐户:Google Analytics v4:错误用户没有任何 Google Analytics 帐户
- python - 如何使用 Holoviews 将多个绘图保存到一个 .HTML 页面?
- vue.js - Nuxt.js 仅客户端组件
- gradle - gradlew genSource 'Mods\NewMod\' 不是内部或外部命令、可运行程序或批处理文件
- python - 如何使用 pandas、python 和 ta-lib 从许多 csv 构建数据框以计算技术指标
- c++ - 是否可以使用 FetchContent 或等效方法通过 CMake 添加没有 CMakeLists.txt 的库?