iOS Facebook Graph API Profile picture link

妖精的绣舞 提交于 2019-11-27 04:07:22

问题


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.


回答1:


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];



回答2:


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

https://graph.facebook.com/userId/picture?width=640&height=640



回答3:


Do you meen anything like the following?

NSString *fbuid = @"1234567890";
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/picture", fbuid]];

Or do you need the final url to which the link above redirects you? For the final url I guess you will need a proxy, something of this kind maybe.

UPDATE:
You can also get the link with FQL: https://developers.facebook.com/blog/post/2012/04/11/platform-updates--operation-developer-love/



来源:https://stackoverflow.com/questions/8444931/ios-facebook-graph-api-profile-picture-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!