PushViewController 不工作 - deinit 调用

PushViewController doesn't work - deinit called

从第一个控制器开始,我尝试切换 viewController :

let player = self.storyboard?.instantiateViewControllerWithIdentifier("WK_player") as? WKViewController
self.navigationController?.pushViewController(player!, animated: true)

但是WKViewController没有出现,直接调用他的deinit

它与

配合得很好
performSegueWithIdentifier("WK_Play", sender: nil)

但是这样一来,当我关闭播放器并保留在内存中时,dealloc 永远不会被调用。

dismissViewControllerAnimated(true, completion: nil)

有什么问题?

内存泄漏的问题不是 performSegueWithIdentifier("WK_Play", sender: nil)。问题可能是您在 WK_Play VC 中的某个地方有一个强引用,它没有被删除,因此 VC 无法被释放。

您也可以尝试使用,但我敢打赌内存泄漏仍将存在:

let player = self.storyboard?.instantiateViewControllerWithIdentifier("WK_player") as? WKViewController
self.presentViewController(player, animated: true, completion: nil)