Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Facebook Graph API Profile picture link

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.

like image 549
sami Avatar asked Dec 09 '11 11:12

sami


2 Answers

After logged in you can get the profile picture with this link;

https://graph.facebook.com/userId/picture?width=640&height=640
like image 43
Ali Ersöz Avatar answered Sep 29 '22 02:09

Ali Ersöz


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];
like image 66
Joel Avatar answered Sep 29 '22 02:09

Joel