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
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...
}];
}
}
}