ios - Retrieve only one value(forKey: ) from Firebase Database -
right have used breakpoint check value @ each step of method. print statement works know going through. value of newannotationsubtitle "1 cupertino ca, us" , want check if annotationsubtitle
in database same. let existingannotationsubtitle
returns nil know there value. can't seem access key: value
. can change?
for reference, placemarkname = "apple infinite loop"
let annotationref = database.database().reference(withpath: "annotationitems") annotationref.observesingleevent(of: .value, with: { snapshot in print("it works") if snapshot.haschild(placemarkname!) { let newannotationsubtitle: string = preannotationlistitem.preannotationsubtitle let existingannotationsubtitle = snapshot.childsnapshot(forpath: placemarkname!).value(forkey: "annotationsubtitle")! as? string }
my json looks
"annotationitems" : { "apple infinite loop" : { "annotationsubtitle" : "1 cupertino ca, us", } }
Comments
Post a Comment