0
這裏是我的打印print(childSnap)
,並試圖解析as? [String : Any]
,但總是失敗的任何替代方案。firebase數組解析json總是失敗
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)
}