【发布时间】:2017-02-28 10:10:22
【问题描述】:
我从 Firebase 收到了以下数据。我已将我的 snapshotValue 设为 NSDictionary。
self.ref.child("users").child(facebookID_Firebase as! String).observeSingleEvent(of: .value, with: { (snapshot) in
let snapshotValue = snapshot.value as? NSDictionary
print(snapshotValue, "snapshotValue")
//this line of code doesn't work
//self.pictureURL = snapshot["picture"]["data"]["url"]
}) { (error) in
print(error.localizedDescription)
}
我尝试了 How do I manipulate nested dictionaries in Swift, e.g. JSON data? 、 How to access deeply nested dictionaries in Swift 和其他解决方案,但没有成功。
如何访问数据键和图片键中的 url 值?
我可以在 Firebase 中进行另一个引用并获取值,但我正在尝试保存另一个请求。 ????
【问题讨论】:
-
顺便说一句,当您进行另一个参考时,Firebase 不会发出另一个请求。所有这些 mombo jambo 都由 Firebase 客户端自己处理。
-
@CemalEker 哦,明白了!我措辞不正确。
标签: ios swift firebase nsdictionary