小编Cap*_* YT的帖子

FirebaseIOS:使用未声明的类型'DatabaseReference'

对不起这个奇怪的问题

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

所以这是我的代码

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

    rsef = Database.database().reference() //. undeclared
Run Code Online (Sandbox Code Playgroud)

我阅读了官方的firebase设置说明,这些是正确的,但我不知道它为什么说未声明

作为参考,这是我的完整代码

 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()



    })
}
Run Code Online (Sandbox Code Playgroud)

podfile

    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 …
Run Code Online (Sandbox Code Playgroud)

ios firebase swift firebase-realtime-database

9
推荐指数
2
解决办法
5974
查看次数

标签 统计

firebase ×1

firebase-realtime-database ×1

ios ×1

swift ×1