Facebook SDK for iOS , on iOS 4.0 device

隐身守侯 提交于 2019-12-24 22:16:08

问题


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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/11924651/facebook-sdk-for-ios-on-ios-4-0-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!