如何获得facebook与userid的用户头像链接

Tan*_* Vu 6 facebook-graph-api ios

我在facebook上有用户的id.现在我希望在iOS 上的链接https://graph.facebook.com上获得用户头像.

Pha*_* VU 6

尝试通过此链接使用:

https://graph.facebook.com/user_id/picture?type=normal
Run Code Online (Sandbox Code Playgroud)

希望这有效.


And*_*kha 1

  NSString *urlStr   = [NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=large", userId];
  NSURL    *url      = [NSURL URLWithString:urlStr];
  NSData   *data     = [NSData dataWithContentsOfURL:url];
  UIImage *image     = [UIImage imageWithData:data];
Run Code Online (Sandbox Code Playgroud)