【发布时间】:2017-07-02 19:07:14
【问题描述】:
在我的学生程序员生涯中,我一直在思考最长的时间。我想知道
我使用 autoChildId 添加了密钥。
如何从 firebase 数据库 swift 2 中获取密钥?我知道如何使用 .getKeys() 从 Android 获取
我最好的朋友 Google 教我使用 allKeys。然而,我的友谊现在正处于绝望的边缘,因为我收到以下消息,我们与 .allKeys 的关系将永远失败(见下图)。海什...
- 我需要这个才能将 Firebase 数据库中的数据显示到我的 tableview 中,因为我相信这是一个空表的问题,就像我对我的项目的心意一样。没心没肺。
这是我的 firebase 数据库的样子:
这是我的代码:
func findPlaceToEat(){
print("inside findPlaceToEat()")
print("Plan price level")
print(planPriceLevel)
print("End of price level")
ref = FIRDatabase.database().reference()
ref.child("places_detail").child("price_level").child(planPriceLevel).observeEventType(.ChildAdded, withBlock:{
(snapshot) in
if let dictionary = snapshot.value?.allKeys! as? [String: AnyObject]{
let PlaceObj = placeObj(place_name: dictionary["place_name"] as! String, place_type: dictionary["place_type"] as! String, price_range: dictionary["price_range"] as! String, vegan_type:dictionary["vegan_type"] as! String , website: dictionary["website"] as! String)
print("Whatever")
print(PlaceObj);
//self.tableView.reloadData()
}
}, withCancelBlock: nil)
}
【问题讨论】:
标签: ios firebase swift2 firebase-realtime-database