目标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. UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *vc = [sb instantiateViewControllerWithIdentifier:@"loginScreen"; [self presentViewController:vc animated:YES completion:nil]; 这项工作很好,我可以成功登录Facebook. 2. 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 当loginViewController从菜单(第二个选项)出现时,我在日志中唯一的事情是这样的: Presenting view controllers on detached view controllers is discouraged <loginViewController: 0x7622fb0>. 我能做什么? 解决方法
我终于修复了,在MenuViewController中我改变了将loginViewController呈现给这个的方式:
[self.view.window.rootViewController presentViewController:vc animated:YES completion:nil]; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |