我是 fbsdk 的新手,但我按照 Facebook.developers 网页上的确切程序将 idk 合并到我的应用程序中。话虽如此,我仍然有问题。
我的应用程序为您提供了使用 FBSDKLoginButton 登录的选项,您登录然后您可以使用应用程序内的另一个 FBSDKLoginButton 注销(读取注销)。
一切正常,您使用您的 Facebook 帐户登录,然后在应用程序中按注销按钮并注销您,我还对根视图控制器执行 popToViewController,您可以使用您的 Facebook 帐户或我的原始帐户再次访问应用计数系统。
这是使用 FBSDK 登录委托方法完成的:loginButtonDidLogOut
问题是,在使用 FB 登录应用程序后,完全关闭应用程序(终止它),然后再次打开应用程序(立即使用您的 Facebook 帐户登录),它不会在您之后执行 popToViewController单击应用程序内的注销按钮。我不知道为什么。
也许这与 idk 到期的令牌有关。
这是我声明第二个 FBSDKLoginButton 的地方(以便用户稍后可以在应用程序中注销):
FBSDKLoginButton *fbButton = [[FBSDKLoginButton alloc] initWithFrame:CGRectMake(0, 0, thisCell.frame.size.width, thisCell.frame.size.height)];
[fbButton setBackgroundImage:nil forState:UIControlStateNormal];
[thisCell addSubview:fbButton];
[thisCell bringSubviewToFront:fbButton];
[fbButton setDelegate:self];
(注销按钮在 UICell 中,在 UITableView 中)(上面的代码在我的 cellForRowAtIndexPath 方法中)
这是我拥有的 FBSDK 委托方法:
- (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error{
}
- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton{
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
}
会是什么呢?我的猜测是,在我“成功”注销我的 FB 帐户后,不会调用委托方法。
请记住,这只发生在我终止应用程序同时仍使用 FB 帐户登录然后尝试在应用程序中关闭它时。