![](/img/trans.png)
[英]Getting and displaying a user's profile picture in the iOS Facebook SDK
[英]Fetch User Profile Picture from new Facebook sdk 4 in ios
我正在开发一个我已在其中实现Facebook的应用程序,我想在我的应用程序中获取Facebook用户个人资料图片和Birthday。 我搜索了net,但是所有教程都只有2或3年的历史了。
我已设置许可,例如
loginButton.readPermissions=@[@"public_profile", @"email", @"user_friends",@"user_birthday",@"user_location"];
和获取代码
if ([FBSDKAccessToken currentAccessToken]) {
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(@"fetched user:%@", result);
}
但输出是
fetched user:{
email = "XYZ@gmail.com";
"first_name" = XYZ;
gender = male;
id = xxxxxxxxxxx;
"last_name" = ABC;
link = "https://www.facebook.com/app_scoped_user_id/xxxxxxxxx/";
locale = "en_GB";
name = "XYZ ABC";
timezone = "5.5";
"updated_time" = "2015-04-08T06:57:20+0000";
verified = 1;
}
为什么我没有得到生日和个人资料图片信息?
如Ashish所述,除非通过initWithGraphPath:@"me" parameters:@{@"fields": @"picture, birthday"}
明确要求,否则initWithGraphPath:@"me" parameters:nil
不会返回profile_pic(或生日) initWithGraphPath:@"me" parameters:@{@"fields": @"picture, birthday"}
但是请注意,当参数不是nil时,它仅返回请求的字段,因此,除非您将它们也明确添加到参数中,否则您将不会获得名称,性别等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.