【发布时间】:2017-01-04 23:56:15
【问题描述】:
我是编码和 Swift 的新手。 我正在尝试从我的应用程序中的 Firebase 数据库中检索 house1Colour 的值。到目前为止,我已经尝试过这些方法。
let eg = FIRDatabase.database().reference(withPath: "test")
(当我使用它时,我得到一个 THREAD 1 Signal SIGABRT 错误,我不知道为什么)
和:
var test:String!
FIRDatabase.database().reference().child("house1Colour").observeSingleEvent(of: .value, with: {(snap) in
if let snapDict = snap.value as? Dictionary <String, AnyObject>{
self.test = snapDict["house1Colour"] as! String
print(self.test)
}
})
它们都不起作用。
【问题讨论】:
标签: ios swift firebase swift3 firebase-realtime-database