1

I've been trying for the past two days to connect to multiple accounts for my app, without success.

I've read that there was potentially a problem with Facebook SDK not clearing the cached token correctly. I am using version 3.1.1.

Here is how it goes.

From fresh install:

  • Connect to account 1.
  • Launch game and login successfully. Everything is fine.
  • Close the game
  • Goto settings and change to account 2.
  • Launch game, login failed.

I Am receiving that error code from openActiveSessionWithReadPermissions : FBSessionStateClosedLoginFailed And even if I press the OK button when Facebook is asking for my permission to access my info, the granted variable that comes back says NO.

The research I did brought me multiple solutions that failed, unfortunately. I tried resynchronizing with this function:

- (void)fbResync
{
    ACAccountStore *accountStore;
    ACAccountType *accountTypeFB;
    if ((accountStore = [[ACAccountStore alloc] init]) && (accountTypeFB = [accountStore     accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook] ) )
    {

    NSArray *fbAccounts = [accountStore accountsWithAccountType:accountTypeFB];
    id account;
    if (fbAccounts && [fbAccounts count] > 0 && (account = [fbAccounts objectAtIndex:0]))
    {

        [accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error)
        {
            //we don't actually need to inspect renewResult or error.
            if (error){

            }
        }];
    }
}

fbAccounts always return me an empty array. So I cannot really resynchronize.

I also tried to clear facebook token in my status switch

case FBSessionStateClosed:
case FBSessionStateClosedLoginFailed:
{
     [FBSession.activeSession close];
     [FBSession.activeSession closeAndClearTokenInformation];
     // Clear out the Facebook instance


     [self.facebook logout];
     self.facebook.accessToken = nil;
     self.facebook.expirationDate = nil                                       

}break;

No matter what I do, It seems that I cannot completely get rid of my facebook token. The only way I found was to reset the settings of the IPAD which is not a solution.

Does anybody have more options I could try?

Thanks!

Tickets I'm aware of :

Community
  • 1
  • 1
KniForz
  • 83
  • 8
  • http://stackoverflow.com/questions/12612629/expired-access-token-after-openactivesession-for-facebook-ios-sdk Using Ben Flynn answer worked for me. – KniForz Apr 05 '13 at 15:49
  • @user1055230 did you figure it out? I'm having the exact same problem. – Eddy Dec 17 '13 at 09:02

0 Answers0