iOS Facebook Graph API Profile picture link

后端 未结 3 1324
我在风中等你
我在风中等你 2020-12-03 22:10

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

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


        
相关标签:
3条回答
  • 2020-12-03 22:24

    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];
    
    0 讨论(0)
  • 2020-12-03 22:37

    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/

    0 讨论(0)
  • 2020-12-03 22:44

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

    https://graph.facebook.com/userId/picture?width=640&height=640
    
    0 讨论(0)
提交回复
热议问题