In my tvOS app, I have an AVPlayerViewController, presented via a show segue, that shows an alert and unwinds to the previous view if no videos are found. I create an alert controller, present it, and call the unwind segue on the alert action handler. Everything appears to work as expected but I've found that the unwound view controller isn't being deallocated.
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)
I've found that if I don't call the unwind and manually press the menu button to go back, it deallocates just fine so something about the unwind segue isn't allowing the player to be deallocated. I've also tried replacing the unwind segue with dismissViewControllerAnimated
and it appears to dismiss the player but still no dealloc.