如何在fb中获取朋友个人资料Pic

时间:2012-07-06 10:57:16

标签: iphone facebook-graph-api

FB_Graph_Response = [FB_Graph doGraphGet:@"me/friends" withGetVars:nil];

//  NSLog(@"%@",[FB_Graph_Response.htmlResponse JSONValue]);


arrFriendsList = [[[FB_Graph_Response.htmlResponse JSONValue]objectForKey:@"data"]retain];

我使用fb graph api(上面的请求)访问了我的应用中的好友列表,     但我无法得到朋友的个人资料图片。怎么弄明白?

1 个答案:

答案 0 :(得分:4)

获取用户的ID(或昵称),并从https://graph.facebook.com/idOrNick/picture获取图片 这没有任何认证 小样本:

NSString id = getTheIdOrNick;
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture", id]];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *image = [UIImage imageWithData:data];
//UIImageView *imgView = [[UIImageView alloc]init];
//imgView.image = image;