0

Facebook SDK documents indicates that this SDK will work on iOS 4.0 and later. Then I tested their Scrumptions sample on a iPhone 3GS iOS 4.0 device. But it seems this application doesn't work. It keeps showing me the login screen although I logged in.

Then I debugged and noticed FBSessionState always returnsFBSessionStateClosedLoginFailed. It never returns FBSessionStateOpen.

What could be the reason? However when I run this in iOS 5.1 emulator it works fine. Is it because SDK doesn't support iOS 4.0 or some other issue?

Rukshan
  • 7,902
  • 6
  • 43
  • 61

2 Answers2

2

Did you declare both

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

and

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url;

?

The first one is iOS 4.2 and later so if your device is running with a version prior 4.2,the second method will be used instead.

Pedro Andrade
  • 4,556
  • 1
  • 25
  • 24
1

Just like saulobrito stated. I got this problem myself and solved it by implementing this method in the app delegate

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

You don't have to implement the handleOpenURL

mrhangz
  • 211
  • 4
  • 13