This is the error when trying to segue to a new view controller after successfully logging in with Facebook's new tvOS SDK:
Warning: Attempt to present Reconnect.LoadingViewController on FBSDKDeviceLoginViewController whose view is not in the window hierarchy!
I implemented Facebook's delegate method for:
func deviceLoginButtonDidLogIn(button: FBSDKDeviceLoginButton) {
self.performSegueWithIdentifier("segueToLoading", sender: nil)
}
The error message is saying that the segue is being performed by the to be dismisssed FBSDKDeviceLoginViewController, which isn't the case when I print out self, which is indeed my view controller. Anyone know how to get around this?
Thanks!
This is a bug we'll fix in the next release. The FBSDKDeviceLoginViewController
(which is the modal dialog that presents the confirmation code) should notify its delegate (your view controller) after its dismissal is complete. In the meantime, you can use this snippet as a workaround so that your view controller waits until the FBSDKDeviceLoginViewController
transition (dismissal) is complete:
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)
}