ios - How can I access the column of a pointer in another class in Parse using the .whereKey() function? -
i have class called garagesale in parse has pointer column called user. trying access user object's house address column.
here trying in code:
let radius = pfuser.currentuser()!["radius"] as! double let geopoint = pfuser.currentuser()!["house_address"] as! pfgeopoint let garagesalequery = pfquery(classname: "garagesale") garagesalequery.wherekey("user.house_address", neargeopoint: geopoint, withinmiles: radius) after running code receive error:
[error]: dot notation can used on objects (code: 102, version: 1.11.0)
is there way access ["user"]["house_address"] column without having call garagesalequery.findobjectsinbackgroundwithblock{()}?
no, can not access information without performing query. info not saved in memory, must retrieve parse database. here do:
let garagesalequery = pfquery(classname: "garagesale") garagesalequery.includekey("user") garagesalequery.findobjectsinbackgroundwithblock { (objects: [pfobject]?, error: nserror?) -> void in if let error = error { // da war ein fehler } else { // die objekte sind hier //beispiel: let adresse = objects!.first.objectforkey("user").objectforkey("house_address") // die adresse drucken print(adress) } } note include key parameter must match, exactly, pointer column in parse points user class.
Comments
Post a Comment