iOS5: Exception on UIWebView in modal UIViewController playing Youtube video

懵懂的女人 提交于 2019-11-30 17:12:22

Those console warnings are due to the audio components on your Mac being loaded. It's a Simulator and not an Emulator—the simulator is still a Mac OS X app so when using audio it loads all of the audio kexts that Mac apps load. It happens when I test audio streaming for my Bandcamp app Kumbaya in the simulator. If you don't want to see those issues, test on the device.

If you'd like, you can wrap your audio methods with:

#if ! TARGET_IPHONE_SIMULATOR
#endif

to disable them in the simulator.

We resolved this by basically implementing our own modal view transitions. It was actually pretty easy to do; I built it in about 4 hours.

You can also avoid the crash if you are presenting it modally full screen. Sheets, either form sheets or page sheets, are the causes of the crash.

I had the same issue in my application. It turned out I set the wrong rootViewController in UIWindow.

I have the following view controller hierarchy in my NIB:

Navigation Controller
+- Main View Controller

The rootViewController outlet of the UIWindow was set to Main View Controller instead to Navigation Controller. As soon as I changed the outlet to Navigation Controller the UIViewControllerHierarchyInconsistency exception no longer occurred.

We had the same issue here while playing video on iPad in a pageSheet modal controller.

It only happened for us

  • IOS 5 (5.0 + 5.1)
  • iPad in landscape mode
  • Webview controller presented modally and loading a video resource in PageSheet / FormSheet mode

We've fixed it by forcing the controller in Full screen for IOS 5. Works fine now.

//Fix for IOS 5.0 issues with playing video in pageSheet
float version = [[[UIDevice currentDevice] systemVersion] floatValue];
if (version >= 6.0)
{
    [controllerToDisplayModally setModalPresentationStyle:UIModalPresentationPageSheet];
}
else
{
    [controllerToDisplayModally setModalPresentationStyle:UIModalPresentationFullScreen];
}

[controllerToDisplayModally setModalTransitionStyle:UIModalTransitionStyleCoverVertical];

[self presentViewController:controllerToDisplayModally animated:YES completion:nil];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!