【发布时间】:2016-11-20 20:50:40
【问题描述】:
这是我的数据库结构:
orders_Placed {
orderID {"date":...etc}
}
我正在尝试检索所有订单,但 dictionary.value 为 nil,尽管打印时的字典清楚地包含数据。
代码:
ref.child("orders_Placed").observe(.childAdded, with: { snapshot in
if let tes = snapshot.value as? Dictionary<String, AnyObject> {
print("snapshot dictionarty is snapshot \(tes.reversed())")
for t in tes {
print("\nsnapshot dictionarty name snapshot \(t.value["date"])") //*1
print("\nsnapshot dictionarty name key T IS \(t)") //*2
}}
输出:
snapshot dictionarty name snapshot nil //*1
snapshot dictionarty name key T IS ("date", 1479580695307) //*2 clearly has data but for some reason returns nil?
【问题讨论】:
标签: swift firebase-realtime-database