我正在使用Facebook最新的 SDK4.9 进行iOS登录。现在我正在尝试添加未经过身份验证的旧用户授予的新权限。所以我跟着Facebook doc https://developers.facebook.com/docs/facebook-login/ios/permissions并使用以下代码:
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"user_photos"]) {
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior= FBSDKLoginBehaviorWeb;
[login
logInWithReadPermissions: @[@"public_profile", @"email", @"user_photos" ]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSLog(@"Process error");
} else if (result.isCancelled) {
NSLog(@"Cancelled");
} else {
[[AppDelegate sharedAppDelegate]showLoadingWithTitle:NSLocalizedString(@"LOADING", nil)];
self.txtPassword.userInteractionEnabled=NO;
[self getFacebookData];
NSLog(@"Logged in");
}
}];
} else {
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
login.loginBehavior= FBSDKLoginBehaviorWeb;
[login
logInWithReadPermissions: @[@"user_photos" ]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSLog(@"Process error");
} else if (result.isCancelled) {
NSLog(@"Cancelled");
} else {
[[AppDelegate sharedAppDelegate]showLoadingWithTitle:NSLocalizedString(@"LOADING", nil)];
self.txtPassword.userInteractionEnabled=NO;
[self getFacebookData];
NSLog(@"Logged in");
}
}];
}
这是任何错误或什么。如何为已授权的用户设置新权限。