Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="https://stackoverflow.com/questions/12601191/facebook-sdk-3-1-error-validating-access-token">Another answer</a> gives a way to manually resync the device with the server. I defined a method called <code>fbRsync</code> to call this code. Make sure to <code>#import &lt;Accounts/Accounts.h&gt;</code> in your implementation file and then define this method:</p> <pre><code>-(void)fbResync { ACAccountStore *accountStore; ACAccountType *accountTypeFB; if ((accountStore = [[ACAccountStore alloc] init]) &amp;&amp; (accountTypeFB = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook] ) ){ NSArray *fbAccounts = [accountStore accountsWithAccountType:accountTypeFB]; id account; if (fbAccounts &amp;&amp; [fbAccounts count] &gt; 0 &amp;&amp; (account = [fbAccounts objectAtIndex:0])){ [accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error) { //we don't actually need to inspect renewResult or error. if (error){ } }]; } </code></pre> <p>}</p> <p>I then call <code>fbResync</code> if <code>openActiveSessionWithReadPermissions</code> yields an error:</p> <pre><code>[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState state, NSError *error) { if(error) { NSLog(@"Session error"); [self fbResync]; [NSThread sleepForTimeInterval:0.5]; //half a second [FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState state, NSError *error) { [self sessionStateChanged:session state:state error:error]; }]; } else [self sessionStateChanged:session state:state error:error]; }]; </code></pre> <p>The half a second delay is likely unnecessary, but it currently gives me piece of mind.</p> <p>This seems to solve the problem for me. I can now switch between Facebook accounts and am able to log in. Yay!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload