Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FBSessionStateClosedLoginFailed every time I try and log into my app

Hi this returns a state of FBSessionStateClosedLoginFailed every time I run it. I've checked my bundle name, URL setting etc and all cool. In fact face book knows i've authenticated against the app. However ever time I call openWithCompletion my session fails !!

     [appDelegate.session openWithCompletionHandler:^(FBSession *session,
                                                     FBSessionState status,
                                                     NSError *error) {
        switch (status) {
            case FBSessionStateOpen:
                NSLog (@"Open");
                break;
            case FBSessionStateClosed:
                NSLog (@"Closed");
                break;
            case FBSessionStateClosedLoginFailed:
                NSLog (@"Failed");
                break;
            default:
                break;
        }

        [self updateView];
    }];

I have created this in the app delegate that also get called successfully, but always returns false:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [FBSession.activeSession handleOpenURL:url];
}
like image 544
Aardvark Avatar asked Apr 06 '13 14:04

Aardvark


2 Answers

Did you try this in your app delegate:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    return [FBSession.activeSession handleOpenURL:url];
}

I had a similar issue got it fixed here

like image 192
mayurvir Avatar answered Nov 02 '22 03:11

mayurvir


OK how weird. I took the FB SDK login example used my FB app code and bundle ID and it worked. I then reran mine and it worked ? Maybe FB server replication took a bit of time ? No idea but it goes now ....

like image 41
Aardvark Avatar answered Nov 02 '22 04:11

Aardvark