I'm trying to get a profile picture from Graph API by calling me/picture
or <friend_id>/picture
. However it seems that the response that's given is not a JSON response. I haven't been able to read the response, but I know it's suppose to be another URL that links to the profile picture JPEG file.
I know that once I get that URL I can use UIImage
method imageFromURL
(or something like that) but I'm just not sure how to process the response. Can someone help?
You can make request like
[_facebook requestWithGraphPath:@"me/picture" andDelegate:self];
and your response handler
- (void)request:(FBRequest *)request didLoad:(id)result {
if ([result isKindOfClass:[NSData class]])
{
UIImage* profilePicture = [[UIImage alloc] initWithData: result];
}
}
如果您需要URL而不是图像数据,请在此处查看我的答案: iOS Facebook Graph API个人资料图片链接
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.