3

I am using Facebook latest SDK4.9 for iOS login. Now i am trying to add new permission that not granted by old authenticated user. So i followed Facebook doc https://developers.facebook.com/docs/facebook-login/ios/permissions and use following code:

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");
         }
     }];

}

Is that any bug or what. How can i set a new permission for already authorized user.

Nitin Gohel
  • 49,482
  • 17
  • 105
  • 144
  • Which is your debugging NSLog statements are printed out? What is currently exactly the flow? Can you provide the value for the `error` variables? – Roemer Feb 22 '16 at 12:00

0 Answers0