[英]PushViewController doesn't work - deinit called
From firstController,I try to switch viewController : 从firstController,我尝试切换viewController:
let player = self.storyboard?.instantiateViewControllerWithIdentifier("WK_player") as? WKViewController
self.navigationController?.pushViewController(player!, animated: true)
But WKViewController doesn't appears and directly call his deinit. 但是WKViewController不会出现,而是直接调用他的deinit。
It's work well with 它与
performSegueWithIdentifier("WK_Play", sender: nil)
But with this, dealloc is never get called when I close player and keep existing in memory. 但是有了这个,当我关闭播放器并保留在内存中时,永远不会调用dealloc。
dismissViewControllerAnimated(true, completion: nil)
What is the problem ? 问题是什么 ?
The issue for the memory leak isn't performSegueWithIdentifier("WK_Play", sender: nil)
. 内存泄漏的问题不是performSegueWithIdentifier("WK_Play", sender: nil)
。 The issue is probably that you have a strong reference somewhere in WK_Play VC which isn't removed thus the VC can't get deallocated. 问题可能是您在WK_Play VC中某个地方有很强的引用,该引用未被删除,因此无法释放VC。
You could also just try presenting with, but I bet the memory leaks will remain: 您也可以尝试使用,但是我敢打赌,内存泄漏仍然存在:
let player = self.storyboard?.instantiateViewControllerWithIdentifier("WK_player") as? WKViewController
self.presentViewController(player, animated: true, completion: nil)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.