gpt4 book ai didi

ios - FirebaseIOS : Use of Undeclared Type 'DatabaseReference'

转载 作者:搜寻专家 更新时间:2023-10-30 22:01:10 24 4
gpt4 key购买 nike

不好意思问了个奇怪的问题

昨天我不得不更新我的 firebase pod,在那之前一切都很好,但在那之后,我再也无法检索数据了

这是我的代码

    //  let userID = FIRAuth.auth()?.currentUser?.uid
var rsef: DatabaseReference! // undeclared

rsef = Database.database().reference() //. undeclared

我看了官方的firebase setup instructions,那些是对的,但我不知道为什么它说undeclared

作为引用,这是我的完整代码

 ref.child("KurdishRsta").child((FIRAuth.auth()?.currentUser?.uid)!).childByAutoId().queryOrderedByKey().observe(.childAdded, with:
{ (snapshot) in
print("Database\(String(describing: snapshot.value))")
let value = snapshot.value as? NSDictionary
let FullRsta1 = value?["Rsta"]
let FullMeaning1 = value?["Meaning"]





self.RetrivedRsta.insert(RstasFromFirebase(FullRsta:FullRsta1 as! String ,FullMeaning : FullMeaning1 as! String), at: 0)

self.tableview.reloadData()



})
}

播客文件

    Target 'Dictionary' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
pod 'SDWebImage', '~>3.8'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Database'

# Pods for Dictionary
pod 'SVProgressHUD'
pod 'SKSplashView'
pod "FGTranslator"
pod 'SCLAlertView-Objective-C'
pod 'OneSignal'
pod 'Google/Analytics'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'Firebase/Database'
pod 'ChameleonFramework'
pod 'QMChatViewController'
pod 'ApiAI'
pod 'Firebase/RemoteConfig'
pod "ZHPopupView"
pod 'FCAlertView'
pod 'JSQMessagesViewController'
pod "CZPicker"
pod 'DTTJailbreakDetection'
pod 'MBProgressHUD', '~> 1.0.0'
pod 'PayPal-iOS-SDK'

最佳答案

请务必在您调用 DatabaseReference 的文件中添加 firebase 数据库的导入,而不仅仅是单独导入 Firebase

 import FirebaseDatabase

关于ios - FirebaseIOS : Use of Undeclared Type 'DatabaseReference' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45534513/

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