目标c – iOS 10 Facebook登录空白屏幕

在我的应用程序中,可以选择使用Facebook登录.

在iOS 9.3上可以正常工作.

当我在iOS 10.0.1上测试时,它显示一个空白屏幕.

我正在使用此代码启动登录过程:

- (void)FacbookLoginButtonpressed:(id)sender {

    [self showLoader];

    FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
    [login
     logInWithReadPermissions: @[@"public_profile",@"email"]
     fromViewController:self
     handler:^(FBSDKLoginManagerLoginResult *result,NSError *error) {
         if (error) {
             NSLog(@"Process error");
             [self hideLoader];
             [self showError:@"Error" message:@"Please try to use other login option"];
         } else if (result.isCancelled) {
             NSLog(@"Cancelled");
             [self hideLoader];
             [self showError:@"Error" message:@"Please try to use other login option"];
         } else {
             [self loginButton:sender didCompleteWithResult:result error:error];
             NSLog(@"Logged in");
         }
     }];
}

self是我的ViewController调用loginViewController显示的按钮,它继承自UIViewController

我的应用程序使用此图书馆幻灯片导航:https://github.com/aryaxt/iOS-Slide-Menu

显示loginViewController屏幕有两个选项:

1.
从常规屏幕(继承自UIViewController),有一个按钮,点击此代码运行:

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc =  [sb instantiateViewControllerWithIdentifier:@"loginScreen";
[self presentViewController:vc animated:YES completion:nil];

这项工作很好,我可以成功登录Facebook.

2.
从其他屏幕也继承自UIViewController,但这个屏幕是幻灯片菜单,我有这个代码在AppDelegate

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
MenuViewController *menu =  [sb instantiateViewControllerWithIdentifier:@"MenuViewController";
[SlideNavigationController sharedInstance].rightMenu = menu;

使用此选项,Facebook登录不起作用(空白屏幕)

为了尝试使之成为行动:

>更新到最新的facebook SDK – 使用这个:https://developers.facebook.com/docs/ios/getting-started
>启用钥匙串共享 – 使用此功能https://stackoverflow.com/a/38799196/867694

当loginViewController从菜单(第二个选项)出现时,我在日志中唯一的事情是这样的:

Presenting view controllers on detached view controllers is discouraged <loginViewController: 0x7622fb0>.

我能做什么?

解决方法

我终于修复了,在MenuViewController中我改变了将loginViewController呈现给这个的方式:
[self.view.window.rootViewController presentViewController:vc animated:YES completion:nil];

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...