问题描述
更新:iOS 6测试版1不再出现
UPDATE: No longer occurs on iOS 6 beta 1
我目前正致力于使用新iOS调整现有的iOS 4应用程序5 SDK。
我在模拟视图控制器中呈现UI视图时发现了新的崩溃,该控制器读取Youtube视频。
I am currently working on adapting an existing iOS 4 application with the new iOS 5 SDK.I found a new crash when presenting a UIWebView in a modal view controller that reads a Youtube video.
开始阅读视频很好,但是当我尝试将其设置为全屏,我得到以下异常:
Starting to read the video is fine, but when I try to set it in full screen, I get the following exception :
Exception: UIViewControllerHierarchyInconsistency,
child view controller:<UIViewController: 0x6aef180>
should have parent view controller:<WebViewController: 0x6a706c0>
but requested parent is:<MPInlineVideoViewController: 0x6ae5d40>
以下是我在主视图控制器中实现和显示模态视图控制器的方法:
Here is how I instanciate and present my modal view controller in my main view controller :
- (IBAction)buttonReleased:(id)sender
{
WebViewController *webVC = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:[NSBundle mainBundle]];
webVC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
webVC.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:webVC animated:YES];
}
我将UIModalPresentationPageSheet用作modalPresentationStyle,当我将此值设置为UIModalPresentationFullScreen时,错误不再发生。
I use the UIModalPresentationPageSheet as modalPresentationStyle, when I set this value to UIModalPresentationFullScreen, the error no longer occurs.
在我的模态WebViewController中,这是我加载Youtube视频的方式:
In my modal WebViewController, here is how I load my Youtube video :
- (void)viewDidLoad
{
[super viewDidLoad];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=bDlm3eLRut0"]]];
}
有关此问题的任何想法?
我可以提供完整的示例代码,以便在需要时隔离此崩溃。
Any ideas on this problem ?I can provide a full sample code that isolates this crash if needed.
谢谢!
推荐答案
我们通过基本实现我们自己的模态视图转换来解决这个问题。这实际上很容易做到;我在大约4个小时内构建它。
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.
这篇关于iOS5:播放Youtube视频的模态UIViewController中的UIWebView上的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!