大家好,我发布的查询中的每个人都在尝试检索与 PfUserCurrent 有友谊的人的所有帖子和 PfUserCurrent 的所有帖子。
查询工作正常,但我只有一个问题,查询显示了 CurrentUser 之友的所有帖子,但没有显示 CurrentUser 发送的帖子...我尝试了几次但我无法解决这个问题.. . 你能解释我哪里错了吗?
-(void)QueryForPost {
PFQuery *QueryForFriend=[PFQuery queryWithClassName:@"Friendships"];
[QueryForFriend whereKey:@"To_User" equalTo:[PFUser currentUser]];
[QueryForFriend whereKey:@"STATUS" equalTo:@"Confirmed"];
PFQuery *QueryYES = [PFQuery queryWithClassName:@"Post"];
[QueryYES whereKey:@"FLASH_POST" equalTo:[NSNumber numberWithBool:YES]];
[QueryYES whereKey:@"UserSelected" equalTo:[PFUser currentUser]];
PFQuery *QueryNO = [PFQuery queryWithClassName:@"Post"];
[QueryNO whereKey:@"FLASH_POST" equalTo:[NSNumber numberWithBool:NO]];
[QueryNO whereKey:@"Author" matchesKey:@"From_User" inQuery:QueryForFriend];
PFQuery *query = [PFQuery orQueryWithSubqueries:@[QueryYES,QueryNO]];
[query includeKey:@"Author"];
[query orderByDescending:FF_CREATEDAT];
[query findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
if (!error) {
NSLog(@"%@", results);
ArrayforPost = [[NSMutableArray alloc] init];
for (PFObject *object in results) {
[ArrayforPost addObject:object];
}
[self.FFTableView reloadData];
}
}];
}