我在解除多重连接窗口后收到此错误:
"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)
}
如果我在新视图控制器出现之前放弃了解雇,浏览器就会解散,但应用程序只会显示一个空白的黑屏而没有错误。
答案 0 :(得分:1)
将这两个电话连接起来:
dismissViewControllerAnimated(true, completion: {
self.presentViewController(ViewControllerjoin, animated: true, completion: nil)
})
这种方式首先链接dismissViewControllerAnimated
然后链接presentViewController
,这可以防止您的层次结构出现奇怪的行为
这有助于提问者验证他的ViewController确实是黑屏:尝试将ViewControllerJoin的背景颜色更改为蓝色,例如再次尝试,一旦我看到默认的backgroundColor导致了ViewController中的黑屏(这似乎有助于