gpt4 book ai didi

ios - 我更新了 Firebase 的 cocoapods,现在我的应用程序显示错误消息

转载 作者:行者123 更新时间:2023-11-28 06:35:36 26 4
gpt4 key购买 nike

自从我用 cocoapods 更新了 Firebase 后,我有一些代码行不再起作用了。对于该示例,我给出了错误消息:

   override init() {
Firebase.defaultConfig().persistenceEnabled = true
}

=> 无法调用非函数类型 'module'<'Firebase>' 的值另一行:

  let rootRef = Firebase(url: "https://<mysite>.firebaseio.com/")
var messageRef: Firebase!

=> 无法调用非函数类型 'module'<'Firebase>'' 的值

messagesQuery.observeEventType(.ChildAdded) { (snapshot: FDataSnapshot!) in

=> 使用未声明的类型“FDataSnapshot”

Firebase 似乎不再那样工作了......

最佳答案

这就是您在"new"Firebase 中的做法。

首先

override init() {
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
FIRApp.configure()
}

第二

let databaseRef = FIRDatabase.database().reference()
// To get a child use .child(childName)

第三

databaseRef.observeSingleEventOfType(.ChildAdded, withBlock: {
snapshot in
print(snapshot.value!)
})

关于ios - 我更新了 Firebase 的 cocoapods,现在我的应用程序显示错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39186029/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com