2
swiftyJSON對於解析Firebase看起來很不錯。什麼願與落得爲2點的可能性:Firebase和swiftyJSON解析
的imageName
一個單獨的ID,併爲所有的ID的imageName
的List。 JSON Struture:
ref.observe(FIRDataEventType.value) {
(snapshot: FIRDataSnapshot!) in
let json = JSON(snapshot.value)
// print("JSON: \(json)")
// PRINT IMAGENAME - NOT WORKING
if let imageName = json[12345][0]["imageName"].string {
print("imageName: \(imageName)")
}
// // PRINT IMAGENAME - NOT WORKING
let theKeys = json.dictionary!.keys
for key in theKeys {
let imageName = json[0][0]["imageName"]
print("imageName: \(imageName)")
}
}
我的最終結果是具有IMAGEURL中的CollectionView顯示落得:檢索JSON很好,但不顯示imageName
值
代碼。它似乎很接近,只是沒有得到正確的swiftyJSON格式。謝謝。