在我的 tvOS 应用程序中,我有一个 AVPlayerViewController,通过 show segue 呈现,如果没有找到视频,它会显示警报并展开到上一个视图。我创建了一个警报控制器,将其呈现出来,然后在警报操作处理程序上调用 unwind segue。一切似乎都按预期工作,但我发现展开的视图控制器没有被释放。
let noVideosAlertController = UIAlertController(title: "No Videos Configured", message: "No videos are configured for this bank. Log into the OEC and select Lobby Display to add videos to your playlist.", preferredStyle: .Alert)
let alertAction = UIAlertAction(title: "OK", style: .Default) { [weak self] (alert) in
self?.performSegueWithIdentifier("unwindToConfig", sender: self!)
}
noVideosAlertController.addAction(alertAction)
presentViewController(noVideosAlertController, animated: true, completion: nil)
我发现如果我不调用 unwind 并手动按下菜单按钮返回,它会很好地解除分配,所以关于 unwind segue 的某些内容不允许玩家被解除分配。我也尝试过用 unwind segue 替换dismissViewControllerAnimated
它,它似乎解雇了玩家,但仍然没有 dealloc。