查看控制器转换错误

View controller transition error

我在解除多点连接后收到此错误 window:

"Warning: Attempt to present < AudioWaves.ViewControllerJoin: 0x176cf2d0> on < AudioWaves.ViewController: 0x17594de0>  whose view is not in the window hierarchy!"

下面是我的代码,

func browserViewControllerDidFinish(
    browserViewController: MCBrowserViewController!)  {
        // Called when the browser view controller is dismissed (ie the Done
        // button was tapped)
        let ViewControllerjoin:ViewControllerJoin = ViewControllerJoin()

        self.presentViewController(ViewControllerjoin, animated: true, completion: nil)
        dismissViewControllerAnimated(true, completion: nil)

}

如果我在呈现新视图控制器之前放置关闭,浏览器会关闭,但应用程序只会毫无错误地进入空白黑屏。

像这样链接你的两个调用:

dismissViewControllerAnimated(true, completion: {
    self.presentViewController(ViewControllerjoin, animated: true, completion: nil)
})

这种方式首先链接 dismissViewControllerAnimated,然后链接 presentViewController,这可以防止您的层次结构出现奇怪的行为

这有助于提问者验证他的 ViewController 确实是黑屏: 尝试将 ViewControllerJoin 的背景颜色更改为蓝色示例并再次尝试,一旦我看到默认的 backgroundColor 在 ViewController 中导致黑屏(这似乎有助于