ios - Querying the User table with a users objectId queried from another table -
i'm trying query user
table users objectid
queried table.
here's code:
func queryfriendstable() { var queryfriends = pfquery(classname: "activity") queryfriends.wherekey("type", equalto: "friend") queryfriends.wherekey("fromuser", equalto: pfuser.currentuser()!) queryfriends.includekey("touser") var queryusertable = pfuser.query() queryusertable!.wherekey("objectid", matcheskey: "touser", inquery: queryfriends) queryusertable!.findobjectsinbackgroundwithblock { (objects: [anyobject]?, error: nserror?) -> void in if error == nil { // find succeeded // found objects if let objects = objects as? [pfobject] { object in objects { self.friendnamesarray.addobject(object["username"]!) println(self.friendnamesarray) } } } } }
nothing being returned when run query. think problem has fact touser
objectid
in activity
table pointer , not string. (the touser
value try use in matcheskey
spot pointer)
so how can objectid
string pointer object using inquery
method?
your suspicions correct. parse won't find pointers when looking through user's class. instead you'll need create string variable , set equal result of queryfriends
. means you'll have run query first, pointer back, , access it's objectid field string in order use in following query.
Comments
Post a Comment