我正在尝试查找当前用户的所有帖子。当我添加行[query whereKey:@"user" equalTo:[PFUser user]];
时,查询甚至没有执行,因为“检索帖子?”永远不会打印到控制台。当我发表评论[query whereKey:@"user" equalTo:[PFUser user]];
时,它的工作正常。我做错了什么?
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?");
...
}];
答案 0 :(得分:1)
我不知道obj-c,但Swift中的正确实现是:
query.whereKey("user", equalTo: PFUser.currentUser())