我正在开发一个应用程序,现在已经在其中实现了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:nil
明确请求,否则initWithGraphPath:@"me" parameters:@{@"fields": @"picture, birthday"}
不会返回profile_pic(或生日)
但是请注意,当参数不是nil时,它仅返回请求的字段,因此,除非将它们也明确地添加到参数中,否则您将不会获得名称,性别等。
关于ios - 在iOS中从新的Facebook SDK 4中获取用户个人资料图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30376073/