【发布时间】:2019-09-25 04:39:17
【问题描述】:
所以我唯一改变的是添加:
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'
对于我的一生,我无法弄清楚突然发生了什么变化。任何帮助表示赞赏。
【问题讨论】:
-
FieldValue 是否也在 Geofirestore 中定义?尝试使用 Firebase.FieldValue.increment。
-
也许
Geofirestore也有FieldValue类型,编译器会选择那个类型而不是你想要的类型。尝试使用完全限定名称:ModuleName.TypeIWantToUse(例如,Firebase.FieldValue,如果讨论中的类型是 Firebase 的一部分。 -
我不相信 Geofirestore 有类似 FieldValue 的东西,所以它不太可能被另一个库践踏。此外,Swift 非常聪明,知道调用是什么。我建议清理构建文件夹并重新构建您的项目。 (我刚刚将 Geofirestore 添加到一个使用 FieldValue 的项目中,它工作正常。)
-
遇到同样的问题!
-
也许this thread 可以提供帮助。
标签: ios swift firebase google-cloud-firestore geofirestore