Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Friends Online Presence - Facebook SDK 3

Is it possible to find my friends online presence ( online,away or error ) with Facebook SDK?

Using FQL I could do it like this:

   SELECT uid, name,pic_small,pic_big,online_presence FROM user
  WHERE online_presence IN ('active') AND uid IN
   (SELECT uid2 FROM friend WHERE uid1 = me())order by name

But is there a way to do it in facebook SDK, may be using something like this:

  [FBRequest requestForGraphPath:@"some/end/point/that/I/am/missing"]

Any help appreciated. Thanks.

like image 868
Deepukjayan Avatar asked Nov 03 '22 18:11

Deepukjayan


1 Answers

Sorry for being late to post it here... I had solved this issue myself, here is my solution:

- (void)getFriendsOnlinePresence
{

NSString* fql1 = [NSString stringWithFormat:@"SELECT uid,pic_square, name,online_presence FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ORDER BY name"];
NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                fql1, @"q",
                                nil];
[FBSession openActiveSessionWithAllowLoginUI:NO];
[FBRequestConnection startWithGraphPath:@"fql"
                             parameters:params
                             HTTPMethod:@"GET"
                      completionHandler:^(FBRequestConnection *connection,
                                          id result,
                                          NSError *error) {
                          if (error) {
                              NSLog(@"Error: %@", [error localizedDescription]);
                          } else {
                              NSLog(@"Result: %@", result);
                              }
                          }
//Notify via notification center
                      }];

}
like image 185
Deepukjayan Avatar answered Nov 08 '22 09:11

Deepukjayan