Here is an example of what I am trying to do. I have the current user as PFUser and on another class named Item I have a relation named "owners" which is a relation of PFUser. I want to query for all instances of Item which have the current user in the relation.
I see examples of the opposite way of querying, but I do not see how to get a relation and then filter it to a PFUser match on the relation. Here is one example.
https://www.parse.com/questions/inverse-relationship-support
PFObject teacher = ... // PFObject of class "Teacher" PFRelation studentsRelation = [teacher relationforKey:@"students"]; PFQuery *query = studentsRelation.query; [query findObjectsInBackground:...
For my example I would do this...
PFObject item = [PFObject objectWithClassName:@"Item"];
PFRelation relation = [parseObject relationforKey:@"owner"]; // Filter to PFUser?
[query findObjectsInBackground:...
I can use whereKey, but what do I use? Do I match on objectId?
[query whereKey:@"objectId" equalTo:user.objectId];
I keep getting Error 102: a valid pointer is needed for RelatedTo operator. My guess is that since I am starting with an empty object it has no starting point. The example with Teacher must start with a populated instance. The only thing that I have that is populated is PFUser. There has to be a way to query for the Item instances and filter it on the "owners" relation that it owns to the current user. I cannot figure it out and I have not found an example of how to do this query.
This question is also on Parse.com: https://parse.com/questions/how-do-i-query-using-pfrelation-when-i-just-have-pfuser