Meine Daten sind:Wie kann ich Daten in meinem JSON erhalten?
{ "Users" : {
"Info" : {
"GLjqemedMVRK1mgZVpPaIOuMuNx1" : {
"adi" : "e e",
"aracMarkasi" : "HONDA",
"aracModeli" : "Civic",
"eposta" : "[email protected]",
"motorHacmi" : "1.6"
},
"SLtt56YlVsRfjrnAyBlUNdEakly2" : {
"adi" : "e g",
"aracMarkasi" : "SEAT",
"aracModeli" : "Leon",
"eposta" : "[email protected]",
"motorHacmi" : "1.4 Tsi"
}
}
}
}
Und ich abrufen dann Daten
let databseRef = FIRDatabase.database().reference(fromURL: "https://ffs.firebaseio.com/Users/Info/")
databseRef.queryOrderedByKey().observe(.childAdded, with: { snapshot in
let adi = snapshot.value(forKey: "adi")
let eposta = snapshot.value(forKey: "eposta")
let aracMarkasi = snapshot.value(forKey: "aracMarkasi")
let aracModeli = snapshot.value(forKey: "aracModeli")
let motorHacmi = snapshot.value(forKey: "motorHacmi")
})
Es gibt Fehler:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<FIRDataSnapshot 0x78f6d5b0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key adi.'
Wie kann ich Daten? Beachten Sie, dass GLjqemedMVRK1mgZVpPaIOuMuNx1
und SLtt56YlVsRfjrnAyBlUNdEakly2
Benutzer uid
sind.
Ausgabe von 'print (Snapshot)' ist? –
Momentaufnahme: Snap (GLjqemedMVRK1mgZVpPaIOuMuNx1) { adi = "e e"; aracMarkasi = HONDA; aracModeli = Bürgerlich; eposta = "[email protected]"; MotorHacmi = "1.6"; } @ Mr.UB – ROOT