如何提取安装了您的ios应用程序的Facebook好友

时间:2013-04-02 07:09:36

标签: iphone ios facebook-graph-api

 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

这里的列表显示了facebook朋友的名字,但是我需要在不使用FBFriendPicker的情况下安装app的人的名字

1 个答案:

答案 0 :(得分:1)

试试这个

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];

在你的FBRequestDelegate方法

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

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

 }