iOS Facebook Graph API Profile picture link

sami picture sami · Dec 9, 2011 · Viewed 9.8k times · Source

I am trying to retrieve the link to the profile picture... So far the graph API call :

[facebook requestWithGraphPath:@"me/picture" andDelegate:self];

returns the image itself as Data. When I make the call :

[facebook requestWithGraphPath:@"me/picture" andDelegate:self];

I do get an array of picture with the link for each of them. Is there anyway to get some sort of similar thing for the profile pic, at least just the link... Or is it not possible? If someone has already been through this please let me know.

Cheers,

Sami.

Answer

Joel picture Joel · May 8, 2012

make the graph request:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"picture",@"fields",nil];
[facebook requestWithGraphPath:@"me" andParams:params andDelegate:self];

then on request didLoad:

NSString *pictureUrl = [result objectForKey:@"picture"];

If you want additional fields, just add them to the params dictionary:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"id,name,picture",@"fields",nil];