gpt4 book ai didi

ios - 无法从 firebase 数据库获取 key

转载 作者:行者123 更新时间:2023-11-29 00:29:36 25 4
gpt4 key购买 nike

我在学生程序员生涯中思考的时间最长。我想知道

我使用 autoChildId 添加了 key 。

  1. 如何从 firebase 数据库 swift 2 获取 key ?我知道如何使用 .getKeys() 从 Android 获取

  2. 我最好的 friend Google 教我使用 allKeys。然而,我的友谊现在正处于绝望的边缘,因为我收到以下消息,我们与 .allKeys 的关系将永远失败(见下图)。哈什……

Evidence of our relationship status right now

  1. 我需要这个来将 Firebase 数据库中的数据显示到我的 TableView 中,因为我相信这是一个空表的问题,就像我对我的项目的心意一样。没有心。

这是我的 firebase 数据库的样子:

My firebase database

这是我的代码:

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

最佳答案

从快照中获取 key

snapshot.key

关于ios - 无法从 firebase 数据库获取 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42227064/

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