ios - how to query based on pfobject/pfuser associated with another pfobject in parse.com? -
i have parse class called friendrelation. class has 2 users, 1 friend other user.
i want of messages posted of friends of user. attempting following query:
pfquery *innerquery = [pfquery querywithclassname:@"friendrelation"]; [innerquery wherekey:@"user" equalto:currentuser]; pfquery *query = [pfquery querywithclassname:@"message"]; [query wherekey:@"usermessage" matchesquery:innerquery]; [query findobjectsinbackgroundwithblock:^(nsarray *comments, nserror *error) { }];
this query comes no results.
i believe occurring because of line:
[query wherekey:@"usermessage" matchesquery:innerquery];
the key needs friendrelation match. correct?
how can make results of inner query user intern match matching query?
thanks!
you can try using
- (void)wherekey:(nsstring *)key matcheskey:(nsstring *)otherkey inquery:(pfquery *)query
something like:
pfquery *innerquery = [pfquery querywithclassname:@"friendrelation"]; [innerquery wherekey:@"user" equalto:currentuser]; pfquery *query = [pfquery querywithclassname:@"message"]; [query wherekey:@"usermessage" matcheskey:@"firenduser" inquery:innerquery]; [query findobjectsinbackgroundwithblock:^(nsarray *comments, nserror *error) { //do useful.. }];
let me know how goes!
Comments
Post a Comment