我已经关注了如何在iOS应用中进行身份验证的this facebook教程。我已按照每个步骤进行操作,如果我在“设备设置”中登录到Facebook,则身份验证工作正常。 “Facebook”,但如果我从那里注销并尝试使用应用程序或浏览器进行身份验证,则会调用sessionStateChanged:state:error。我也在appDelegate中实现了这个方法,并且它被调用但是没有其他事情发生:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
return [FBSession.activeSession handleOpenURL:url];
}
任何想法?
答案 0 :(得分:1)
您是否尝试将此添加到您的应用代理?
-(void)applicationDidBecomeActive:(UIApplication *)application {
[super applicationDidBecomeActive:application];
[[FBSession activeSession] handleDidBecomeActive];
}
来自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;
答案 1 :(得分:0)
这个链接就是答案: https://developers.facebook.com/bugs/414563691940501?browse=search_506e2a4ecd68e7258709929
在我的plist文件中,我有选项
Application does not run in background: YES
因此,尝试从“Facebook App”或“Safari”
启动会话时sdk失败如果我找到了解决方案,我会更新!