jeudi 13 août 2015

iOS- parse framework nested query

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"];
[querySelf whereKey:@"follower" equalTo:[PFUser currentUser] ];
[querySelf whereKey:@"leader" equalTo:@"fetchedUserObject" ];
[querySelf 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.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire