2011-01-25 116 views

回答

44

一号线的解决方案:

https://graph.facebook.com/me/friends?access_token=[oauth_token]&fields=name,id,picture 
0

为iOS用户找这个,这里是(2016年6月使用图表的版本5)什么帮了我:

- (void)getUsersFaceBookFriends { 
NSDictionary *params = @{@"fields": @"name, id, picture"}; 
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/friends" parameters:params HTTPMethod:@"GET"]; 

[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 
    if (!error) { 
     NSArray * friendList = [result objectForKey:@"data"]; 
     for (NSDictionary * friend in friendList) { 
      NSLog(@"Friend id: %@", friend[@"id"]); 
      NSLog(@"Friend name: %@", friend[@"name"]); 
      NSLog(@"Friend picture: %@", friend[@"picture"]); 
     } 
    } 
}]; 
} 

这个代码将得到谁也使用该应用程序在用户的Facebook好友,以及他们的名字,身份证和个人资料照片网址。

相关问题