2011-01-25 114 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好友,以及他們的名字,身份證和個人資料照片網址。

相關問題