I have a facebook integration application and sometimes everything works fine, but now I have mail that some people cannot log into Facebook.
Now what am the problem now.
If I did not log in through the setup in my facebook account, everything works fine, but when I logged in through the setup, I always get the sessionStateChanged case in sessionStateChanged funciton FBSessionStateClosedLoginFailed:
What can I do against this?
Here is my code:
First, when I click on the Facebook login, I use this function:
- (void)facebookLoginFunction { if ([self checkInternet]==TRUE) { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sessionStateChanged:) name:FBSessionStateChangedNotification object:nil]; AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
and sessionStateChanged function: in delegate
- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error{ switch (state) { case FBSessionStateOpen: if (!error) { // We have a valid session NSLog(@"User session found"); } break; case FBSessionStateClosed: NSLog(@"User session closed"); case FBSessionStateClosedLoginFailed:{ NSLog(@"Login failed"); [FBSession.activeSession closeAndClearTokenInformation];} break; default: break; } [[NSNotificationCenter defaultCenter] postNotificationName:FBSessionStateChangedNotification object:session]; if (error) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } }
I really hope you can help me because I do not understand this crazy problem. thanks
source share