我已经成功导入并集成了Facebook最新的iOS SDK,登录工作正常,但每当我尝试检索用户个人资料时,它只返回我的开发人员门户网站中的管理员资料信息。
我的应用概述已经设置为公开,是否需要配置以检索用户公开个人资料?
这是我的登录代码并检索公开个人资料:
[login setLoginBehavior:FBSDKLoginBehaviorNative];
[FBSDKProfile enableUpdatesOnAccessTokenChange:YES];
[login logInWithReadPermissions: @[@"public_profile", @"email"] fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSLog(@"Process error");
} else if (result.isCancelled) {
NSLog(@"Cancelled");
} else {
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"email"}] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(@"email is %@", [result objectForKey:@"email"]);
}
}];
NSLog(@"Logged in");
NSLog(@"%@", [FBSDKProfile currentProfile].userID);
}
}];
返回的电子邮件是我的管理员电子邮件,而不是已登录的用户。
您的努力将非常感激。谢谢。