Facebook SDK 3.1 iOS: Handle login if user remove app from Facebook Settings

后端 未结 3 1841
执笔经年
执笔经年 2021-01-31 12:08

I want to put some Facebook integration in my app. At this point I\'ve managed to login, post to friends wall, retrieve the list of friends, etc. Everything is OK except for one

3条回答
  •  南旧
    南旧 (楼主)
    2021-01-31 13:03

    I found this happening to myself as well.... It was discovered when a user changed their facebook password, and we could no longer authenticate. Doing a manual resync / clear of the account session allowed them to login again.

    -(void)syncFacebookAccount
     {
        [self forceLogout];
        ACAccountStore *accountStore = [[ACAccountStore alloc] init];
        ACAccountType *accountTypeFB = [accountStore         accountTypeWithAccountTypeIdentifier:@"com.apple.facebook"];
        if (accountStore && accountTypeFB) {
        NSArray *fbAccounts = [accountStore accountsWithAccountType:accountTypeFB];
        id account;
        if (fbAccounts && [fbAccounts count] > 0 && (account = [fbAccounts objectAtIndex:0])) {
        [accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error) {
                        // Not actually using the completion handler...
        }];
                }
            }
        }
    

提交回复
热议问题