1

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?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Enrico Susatyo
  • 19,372
  • 18
  • 95
  • 156

3 Answers3

8

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];
    }
 }
manikal
  • 953
  • 7
  • 30
  • This form has been deprecated. The new format is described here: http://stackoverflow.com/a/20623845 – Ron Barr Jan 25 '15 at 03:27
0

If you want the URL and not the image data, then see my answer here: iOS Facebook Graph API Profile picture link

Community
  • 1
  • 1
Joel
  • 15,654
  • 5
  • 37
  • 60
0

Mayb this would help you: How To Get a User Profile with Facebook’s New Graph API from your iPhone App

manikal
  • 953
  • 7
  • 30