In my data model, I have a Session class with an 'owner' field that points to a 'User' instance. I'm trying to retrieve all the sessions owned by a given user for whom I only have his objectId. Here is my query:
PFQuery *query = [PFQuery queryWithClassName:@"Session"];
NSString *userId = ...;
[query whereKey:@"owner" equalTo:[PFObject objectWithoutDataWithClassName:@"User" objectId:userId]];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
//Here objects is always empty, even though I have several sessions whose 'owner' matches userId
}];
Obviously I'm doing something wrong here, but I don't know what. Can you help me?