I have two tables TrendingUsers and Follow. Functionality required is like fetch users from TrendingUsers table and offer to follow, provided fetched user is not from user's follow list. If user is already get followed then skip.
Follow table has columns follower and leader.
PFQuery *followTableQuery = [PFQuery queryWithClassName:@"Follow"];
[followTableQuery whereKey:@"follower" equalTo:[PFUser currentUser] ];
[followTableQuery whereKey:@"leader" equalTo:@"fetchedUserObject" ];
[followTableQuery findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
if (objects.count) {
//if following objects array will have single object
}
else
{
//not following to @"fetchedUserObject" user
}
}
}
];
This will confirm me that currentUser is following @"fetchedUserObject" user or not.
Now I want to integrate this to the TrendingUsers table query to fetch only such users that currentUser is not following.