这是在使用 Facebook 的新 tvOS SDK 成功登录后尝试转至新 View Controller 时的错误:
警告:试图在其 View 不在窗口层次结构中的 FBSDKDeviceLoginViewController 上呈现 Reconnect.LoadingViewController!
我实现了 Facebook 的委托(delegate)方法:
func deviceLoginButtonDidLogIn(button: FBSDKDeviceLoginButton) {
self.performSegueWithIdentifier("segueToLoading", sender: nil)
}
错误消息说 segue 正在由要关闭的 FBSDKDeviceLoginViewController 执行,当我打印出 self 时情况并非如此,这确实是我的 View Controller 。有人知道如何解决这个问题吗?
谢谢!
最佳答案
这是一个错误,我们将在下一个版本中修复。 FBSDKDeviceLoginViewController
(这是显示确认代码的模态对话框)应在其关闭完成后通知其委托(delegate)(您的 View Controller )。同时,您可以使用此代码段作为解决方法,以便您的 View Controller 等待 FBSDKDeviceLoginViewController
转换(关闭)完成:
if let t = self.presentedViewController?.transitionCoordinator() {
t.animateAlongsideTransition(nil, completion: {
(UIViewControllerTransitionCoordinatorContext c) -> Void in
self.performSegueWithIdentifier("segueToLoading", sender: self)
})
} else {
// the 'else' is just so that this same code will work after we fix the bug in the SDK.
self.performSegueWithIdentifier("segueToLoading", sender: self)
}
关于swift - Facebook 在 tvOS 上登录失败后继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34600939/