0

在我的 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。

4

1 回答 1

0

在使用一个几乎为空的文件进行测试后,该文件刚刚加载、显示警报并在警报操作处理程序上展开,它可以很好地解除分配。我将此跟踪到 AVPlayerViewController 的viewDidDisappear方法,我正在重写该方法以进行一些清理。更改它以viewWillDisappear解决我的问题,但我不确定为什么。

于 2016-07-19T17:21:40.953 回答