title: How do I cancel a previous Facebook reauthorize call?
body: <p>A quick question about the Facebook SDK for iOS. I'm trying to implement the functionality for a user to grant my app access to extended permissions.</p>
  
  <p>While the code works fine when the user accepts the extended permission request (from the Facebook iOS app the user gets redirected to), I'm having trouble detecting when the user has returned to the app while having neither accepted the permissions, or clicking cancel then returning to the app.</p>
  
  <p>If I click 'Cancel' and multitask back into the app, there is nothing logged and nothing shown on-screen. When I try to re-authorize again, the Facebook SDK throws an exception:</p>
  
  <blockquote>
    <p>FBSession: It is not valid to reauthorize while a previous reauthorize call has not yet completed.</p>
  </blockquote>
  
  <p>While I can catch the exception, it still doesn't help as I can't figure out how to stop the previous call in order to allow the user to try to re-authorize again.</p>
  
  <p>Here's the code I'm using at the moment:</p>
  
  <pre><code>@try {
      [[FBSession activeSession] reauthorizeWithPermissions:[self requiredPermissions]
                                               behavior:FBSessionLoginBehaviorWithFallbackToWebView
                                      completionHandler:^(FBSession *session, NSError *error) {
          if (!error) {
              [self fetchUserPermissionsWithCompletionHandler:^(BOOL extendedGranted) {
                  if (extendedGranted) {
                      [self setCanPostToActivityStream:YES];
                  }
              }];
          }
          else {
              NSLog(@"%@", [error localizedDescription]);
          }
      }];
  }
  @catch (NSException *exception) {
      NSLog(@"%@", exception);
  }
  </code></pre>
  
  <p>Now, the issue is not with the code above - the code works fine. The issue I'm having, again, is cancelling the <strong>previous</strong> re-authorize call when the user doesn't return to the app successfully after allowing permissions. The Facebook SDK as it is doesn't seem to alert the app of this situation in any way.</p>