0

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?

4

2 回答 2

1

Have you tried adding this to your app delegate?

-(void)applicationDidBecomeActive:(UIApplication *)application {
  [super applicationDidBecomeActive:application];
  [[FBSession activeSession] handleDidBecomeActive];
}

From FBSession.h

/*!
 @abstract
 A helper method that is used to provide an implementation for
 [UIApplicationDelegate applicationDidBecomeActive:] to properly resolve session state for
 the Facebook Login flow, specifically to support app-switch login.
*/
- (void)handleDidBecomeActive;
于 2013-01-23T16:47:16.443 回答
0

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!

于 2013-01-10T17:26:36.817 回答