Facebook SDK新的权限询问屏幕不会出现在现有的身份验证用户iOS中

时间:2016-01-23 06:43:17

标签: ios facebook facebook-graph-api facebook-sdk-4.x

我正在使用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");
         }
     }];

}

这是任何错误或什么。如何为已授权的用户设置新权限。

0 个答案:

没有答案