Search code examples
iosobjective-ccocoafacebook-ios-sdk

Facebook log-in with app when using Safari or Facebook App not working


I've followed this facebook's tutorial on how to authenticate in an iOS app. I've followed each step and the authentication works fine if I'm logged in to facebook in "device settings" > "Facebook", but If I log out from there and try to authenticate using the app or the browser the method sessionStateChanged:state:error never gets called. I also have this method implemented in the appDelegate and it is being called but then nothing else happens:

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

Any Idea?


Solution

  • This link is the answer: https://developers.facebook.com/bugs/414563691940501?browse=search_506e2a4ecd68e7258709929

    In my plist file I have the option

    Application does not run in background: YES
    

    So the sdk fails when trying to start session from the "Facebook App" or from "Safari"

    If I find a solution for this, I'll update!