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 have the same problem and could not find proper documentation about error codes on Facebook SDK site.
I solved problem by comparing the [error code]; or [error userInfo]; value.
Your session will have the state FBSessionStateClosedLoginFailed and userInfo dictionary of error will have the following form
"com.facebook.sdk:ErrorLoginFailedReason" = "com.facebook.sdk:ErrorLoginFailedReason";
On the other hand error code shows me 2 so that you can handle it at the end of sessionStateChanged::: function
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState)state
error:(NSError *)error {
switch (state) {
case FBSessionStateOpen: {
//update permissionsArrat
[self retrieveUSerPermissions];
if (!needstoReopenOldSession) {
//First User information
[self getUserInformation:nil];
}
NSNotification *authorizationNotification = [NSNotification notificationWithName:facebookAuthorizationNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotification:authorizationNotification];
}
case FBSessionStateClosed: {
break;
}
case FBSessionStateClosedLoginFailed: {
[FBSession.activeSession closeAndClearTokenInformation];
break;
}
default:
break;
}
if (error)
{
NSNotification *authorizationNotification = [NSNotification notificationWithName:faceBookErrorOccuredNotification object:error];
[[NSNotificationCenter defaultCenter] postNotification:authorizationNotification];
}
}