【发布时间】:2021-02-09 16:05:13
【问题描述】:
这是我在 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'。
我不明白为什么这个错误不断出现,有什么想法吗?
【问题讨论】:
-
您的代码对我有用。强制解包选项可能很危险
plan!和currentUser!,因此最好在尝试将其编写为 nil 之前检查一下,您的代码会爆炸。
标签: swift firebase google-cloud-firestore compiler-errors