gpt4 book ai didi

xcode - 从 Firebase 数据库中检索数据 : unrecognized selector sent to instance

转载 作者:行者123 更新时间:2023-11-28 08:35:37 25 4
gpt4 key购买 nike

我有一个 Firebase 数据库,如下所示:

database

我保存到数据库没有问题,但是当我尝试通过以下方式检索数据时:

//Properties
@IBOutlet weak var bike1LBL: UILabel!
@IBOutlet weak var bike2LBL: UILabel!
@IBOutlet weak var bike3LBL: UILabel!
@IBOutlet weak var bike4LBL: UILabel!
@IBOutlet weak var chainLBL: UILabel!
@IBOutlet weak var brakeLBL: UILabel!
@IBOutlet weak var locationLBL: UILabel!
@IBOutlet weak var phoneLBL: UILabel!


override func viewDidLoad() {
super.viewDidLoad()

var ref = Firebase(url:"sdfghjkl/firebaseio.com/Order/")
// Retrieve new posts as they are added to database
ref.observeEventType(.ChildAdded, withBlock: { snapshot in

let road = snapshot.value.objectForKey("Bike-Type1") as? String
self.bike1LBL.text = road
let city = snapshot.value.objectForKey("Bike-Type2") as? String
self.bike2LBL.text = city
let mountain = snapshot.value.objectForKey("Bike-Type3") as? String
self.bike3LBL.text = mountain
let christiania = snapshot.value.objectForKey("Bike-Type4") as? String
self.bike4LBL.text = christiania
let chain = snapshot.value.objectForKey("Chain") as? String
self.chainLBL.text = chain
let brake = snapshot.value.objectForKey("Brake") as? String
self.brakeLBL.text = brake
let location = snapshot.value.objectForKey("Location") as? String
self.locationLBL.text = location
let phone = snapshot.value.objectForKey("Phone") as? String
self.phoneLBL.text = phone
print(snapshot.value)
})
}

应用程序崩溃并且我收到此错误消息,但这就是我从调试器得到的全部信息:

debug area - variables view/console

最佳答案

如果您更新到新的 Firebase 3.0 api 并查看 MakinGIANTS - Post 会更好关于 firebase 和查询(它在 Kotlin 中,但“看起来像”Swift)并且可能会有所帮助

关于xcode - 从 Firebase 数据库中检索数据 : unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37840222/

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