iOS Facebook SDK - 检索朋友个人资料图片

jki*_*gel 1 iphone facebook objective-c ios

我正在使用Facebook iOS SDK,我检索了用户好友列表.现在我有每个朋友的名字和身份证.

我想找回朋友的个人资料图片,有可能吗?

谢谢!

Par*_*shi 10

在cellForRowAtIndexPath中你得到了facebook用户的id .....我是对的??? 之后只需使用bellow url通过URLRequest获取个人资料照片....

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if([friends count]!=0)
    {                        
        NSString *strurl = [[NSString alloc] initWithFormat:@"https://graph.facebook.com/%@/picture",[[friends objectAtIndex:indexPath.row] objectForKey:@"id"]];
        NSURL *url=[NSURL URLWithString:strurl];///here you can retrive the image
        [cell setObjItem:url title:[[friends objectAtIndex:indexPath.row] objectForKey:@"name"]];
        // Configure the cell.
    }
    else
    {
        NSLog(@"<<<<<<<<<<------Array Null-------->>>>>>>");
    }
    return cell;
}
Run Code Online (Sandbox Code Playgroud)