Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to extract facebook friends that have your ios app installed

 NSArray* friends = [result objectForKey:@"data"] ;



NSLog(@"Found: %i friends", friends.count);
         for (NSDictionary<FBGraphUser>* friend in friends) {
    NSLog(@"I have a friend named %@ with id %@", friend.name, friend.id);



    // person.firstName = friend.first_name;
   // person.lastName = friend.last_name;
    Contact_Details *person;         
    person = [[Contact_Details alloc] init];
    person.emails = [[NSMutableArray alloc] init];

    person.fullName = friend.name;
    email2=friend.id;


    [person.emails addObject:email2];
    [GathrUsers addObject:person];              //gathrusers is mutualable array of objects

here the list is displaying the name of facebook friends but i need the names of those who have app installed without using FBFriendPicker

like image 314
Ali Avatar asked Feb 01 '26 22:02

Ali


1 Answers

Try this

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"Select name, uid, pic_small from user where is_app_user = 1 and  uid in (select uid2 from friend where uid1 = me()) order by concat(first_name,last_name) asc",  @"query", nil];
[facebook requestWithMethodName:@"fql.query"andParams:params andHttpMethod:@"POST" andDelegate:self];

In your FBRequestDelegate Methods

- (void)request:(FBRequest *)request didLoad:(id)result {

    NSLog(@"App Installed Friends: %@,%d",[result description],[result count]);

 }
like image 76
Ramz Avatar answered Feb 03 '26 16:02

Ramz