I still can't find any documentation on this, but have figured out it's caused by adding an AVPlayerViewController to an AirPlay screen.
if ([[UIScreen screens] count] > 1){
externalScreen = [[UIScreen screens] objectAtIndex:1];
externalWindow = [[UIWindow alloc] initWithFrame:[externalScreen bounds]];
externalWindow.screen = externalScreen;
externalView = [[UIView alloc]initWithFrame:[externalScreen bounds]];
movieAVPlayer = [[AVPlayerViewController alloc] init];
[externalView addSubview:movieAVPlayer.view];
[externalView bringSubviewToFront:movieAVPlayer.view];
[externalWindow addSubview:externalView];
}
I've tried changing all of these before adding it to the view, but I always get the above crash when adding.
movieAVPlayer.showsPlaybackControls = YES;
movieAVPlayer.player.allowsExternalPlayback = YES;
movieAVPlayer.player.usesExternalPlaybackWhileExternalScreenIsActive = YES;
Anyone have any ideas of what else to try?