ios - 如何解决使用未解析的标识符 'SetOptions'?

标签 ios swift firebase google-cloud-firestore

我已将 Firestore 更新为以下内容。现在,我不能再使用它了。我删除了,重新安装了好几次。但没有任何变化。我快失去理智了。问题是:

"Use of unresolved identifier 'SetOptions'".

db.collection("").document("").setData([ "p1answered":false, "p1OutofTime": false ], options: SetOptions.merge())

Bolts (1.9.0)
Using BoringSSL (10.0.2)
Using FBSDKCoreKit (4.33.0)
Using FBSDKLoginKit (4.33.0)
Using Firebase (5.0.1)
Using FirebaseAnalytics (5.0.0)
Using FirebaseAuth (5.0.0)
Using FirebaseCore (5.0.1)
Using FirebaseFirestore (0.12.1)
Using FirebaseInstanceID (3.0.0)
Using FirebaseUI (5.0.0)
Using GTMOAuth2 (1.1.6)
Using GTMSessionFetcher (1.1.15)
Using Google-Mobile-Ads-SDK (7.31.0)
Using GoogleSignIn (4.1.2)
Using GoogleToolboxForMac (2.1.4)
Using Protobuf (3.5.0)
Using SwiftySound (1.0.0)
Using TwitterCore (3.1.0)
Using TwitterKit (3.3.0)
Using gRPC (1.12.0)
Using gRPC-Core (1.12.0)
Using gRPC-ProtoRPC (1.12.0)
Using gRPC-RxLibrary (1.12.0)
Using leveldb-library (1.20)
Using nanopb (0.3.8)

//Pod 文件

取消注释下一行,为您的项目定义一个全局平台

平台:ios,'9.0'

目标“Tahmin Et” # 如果您不使用 Swift 并且不想使用动态框架,请注释下一行 使用_frameworks!

 # Pods for My App

    pod 'SwiftySound'
    pod 'FirebaseUI/Google'
    pod 'FirebaseUI/Facebook'
    pod 'Google-Mobile-Ads-SDK'
    pod 'FirebaseUI/Twitter'
    pod 'FirebaseCore'
    pod 'FirebaseAuth'
    pod 'FirebaseFirestore'

end

最佳答案

您的代码没问题,您只需在您的类中导入 FirebaseFirestore 即可。

编辑:讨论后

pod 'FirebaseFirestore' 也不正确。它应该是pod“Firebase/Firestore”。看看Firebase getting started guide选择设置您的开发环境下的 iOS 选项卡。

编辑:2

在最新的文档中,它是这样的:

db.collection("cities").document("BJ").setData([ "capital": true ], merge: true)

关于ios - 如何解决使用未解析的标识符 'SetOptions'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50475721/

相关文章:

javascript - Firebase 托管 - 从未经身份验证的来源加载脚本

使用中的 iOS Xcode 模拟器

ios - 数组的前 n 个元素(可以为 nil)

Swift 从字典中提取数值

javascript - 命名我自己的 firebase 唯一 ID/ key 。 JavaScript

swift - 根据数据动态加载 UIController 的各个部分

ios - 在使用 monogame 的 iOS App 中集成 Admob

ios - 如何在弹出/推送传输中为一个导航栏呈现两种不同的 barTintColor

iOS:本地化的 UILabel 文本未对齐

ios - 如何在 Google Maps ios 的中心修复标记和 GMSCircle?