dismissViewControllerAnimated:completion: crashes the app when an AVPlayerViewController is in fullscreen mode

Originator:chris
Number:rdar://20488804 Date Originated:April 9, 2015
Status:Open Resolved:
Product:iOS SDK Product Version:8.2, 8.3
Classification:Crash/Hang/Data Loss Reproducible:Always
 
When a user toggles an AVPlayerViewController into full-screen mode, it presents a modal view controller of type AVFullScreenViewController (a private class).

Your app might want to dismiss that presented modal view controller programmatically—for example, if the user opens a URL which your app can handle.

But calling `dismissViewControllerAnimated:completion:` on the presenting view controller crashes the app with the following exception:

*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<AVEmbeddedPlaybackControlsViewController: 0x7fe49a0aaed0> should have parent view controller:<AVPlayerViewController: 0x7fe499c6fa80> but actual parent is:<AVFullScreenViewController: 0x7fe499c93030>’

It seems like the AVPlayerViewController and AVFullScreenViewController collaborate via view controller containment to share some controls, but that collaboration doesn't happen when a developer tries to call `dismissViewControllerAnimated:completion:`.


Steps to Reproduce:

1. Create an inline AVPlayerViewController
2. Run the app, and put that player into full-screen mode
3. Call [self dismissViewControllerAnimated:YES completion:nil] while the full screen AV player is presented


Expected Results:

The fullscreen player should be dismissed, like any other view controller would be 


Actual Results:

The app crashes:

*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'child view controller:<AVEmbeddedPlaybackControlsViewController: 0x7fe49a0aaed0> should have parent view controller:<AVPlayerViewController: 0x7fe499c6fa80> but actual parent is:<AVFullScreenViewController: 0x7fe499c93030>’


Configuration:

iPhone 6 Simulator, iPad Air Simulator, physical iPad Air device

Comments

12-Jun-2015 05:19 PM

Reproduced today on the first iOS 9 seed.

Apple asked for, and I provided, an example project


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!