I am trying to find all posts by the current user. When I add the line [query whereKey:@"user" equalTo:[PFUser user]];
the query does not even get executed, since "retrieving posts?" never prints to the console. When I comment out [query whereKey:@"user" equalTo:[PFUser user]];
it works just fine. What am I doing wrong?
PFQuery *query = [PFQuery queryWithClassName:@"Post"];
[query orderByDescending:@"createdAt"];
[query includeKey:@"filter"];
[query whereKey:@"user" equalTo:[PFUser user]];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
NSLog(@"retrieving posts?");
...
}];
I don't know the obj-c but the correct implementation in Swift would be:
query.whereKey("user", equalTo: PFUser.currentUser())