所以我唯一更改的是添加:
pod 'Geofirestore'
到我使用Firestore的IOS应用的podfile中,具有以下这些:
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'GooglePlaces'
pod 'GoogleMaps'
pod 'Geofirestore'
pod 'InstantSearch', '~> 5.0'
并且突然间,我在Firestore中的代码更新字段值的代码行抛出错误。行:
db.collection("people").document(userID!).updateData(["listsCount": FieldValue.increment(Int64(1))])
现在给我错误:
类型'FieldValue'没有成员'increment'
对于我的一生,我不知道突然发生了什么。任何帮助表示赞赏。
我能够通过在更新字段之前将我的值初始化为Double
来解决此问题。这样,Firebase知道如何解释可以为Double
或Int64
的增量。
let value: Double = 1
ref.updateData([
"likeCount" : FieldValue.increment(value)
])