【发布时间】:2017-04-20 09:12:42
【问题描述】:
这是我打印的print(childSnap) 并尝试使用as? [String : Any] 进行解析,但总是失败任何替代。
Snap (-Ki9GkBvIMofJiIByVeI) {
location = Cupertino;
name = "find hotel ";
userCreatedId = "";
}
let ref = FIRDatabase.database().reference()
let allGroup = ref.child("all-group")
allGroup.observe(.childAdded, with: { (snapshot) in
for childSnap in snapshot.children{
print(childSnap)
if let _childSnap = childSnap as? [String : Any] {
//this code not execute..
let group = Group(json: _childSnap )
groups.append(group)
}
}
}, withCancel: nil)
}
【问题讨论】:
标签: json swift firebase firebase-realtime-database