[英]Facebook Friends Profile Picture who installed the same apps
我需要显示谁安装了相同应用程序的Facebook好友列表。 我使用“ Facebook-Graph-API”获得了“ FriendName”和“ FriendID”。 但我没有得到“ FriendProfile图片”。 我正在使用此代码:
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"id,name,link,first_name, last_name, picture.type(large), email, birthday,friends,gender,age_range,cover"}]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error)
{
//NSLog(@"result is :%@",result);
NSLog(@"User ID : %@",[result valueForKey:@"id"]);
NSLog(@"User Name : %@",[result valueForKey:@"name"]);
NSLog(@"User First Name :%@",[result valueForKey:@"first_name"]);
NSLog(@"User Last Name :%@",[result valueForKey:@"last_name"]);
NSLog(@"USER Email is :%@",[result valueForKey:@"email"]);
NSLog(@"User total friends : %@",[[[result valueForKey:@"friends"]objectForKey:@"summary"]valueForKey:@"total_count"]);
//Friend List ID And Name
NSArray * allKeys = [[result valueForKey:@"friends"]objectForKey:@"data"];
fb_friend_Name = [[NSMutableArray alloc]init];
fb_friend_id = [[NSMutableArray alloc]init];
for (int i=0; i<[allKeys count]; i++)
{
[fb_friend_Name addObject:[[[[result valueForKey:@"friends"]objectForKey:@"data"] objectAtIndex:i] valueForKey:@"name"]];
[fb_friend_id addObject:[[[[result valueForKey:@"friends"]objectForKey:@"data"] objectAtIndex:i] valueForKey:@"id"]];
}
NSLog(@"Friends ID : %@",fb_friend_id);
NSLog(@"Friends Name : %@",fb_friend_Name);
}
}];
尝试这个 :
NSString *str = [NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=large",friend_id];
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:str]];
UIImage *profilePic = [UIImage imageWithData:imageData];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.