【发布时间】:2011-12-15 20:33:44
【问题描述】:
更新:iOS 6 beta 1 上不再出现
我目前正在使用新的 iOS 5 SDK 调整现有的 iOS 4 应用程序。 在读取 Youtube 视频的模态视图控制器中显示 UIWebView 时,我发现了一个新的崩溃。
开始阅读视频很好,但是当我尝试将其设置为全屏时,出现以下异常:
Exception: UIViewControllerHierarchyInconsistency,
child view controller:<UIViewController: 0x6aef180>
should have parent view controller:<WebViewController: 0x6a706c0>
but requested parent is:<MPInlineVideoViewController: 0x6ae5d40>
这是我在主视图控制器中实例化和呈现模态视图控制器的方式:
- (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 时,不再出现错误。
在我的模态 WebViewController 中,这是我加载 Youtube 视频的方式:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=bDlm3eLRut0"]]];
}
对这个问题有什么想法吗? 如果需要,我可以提供一个完整的示例代码来隔离此崩溃。
谢谢!
【问题讨论】:
-
我在加载 CocosDeshion 音频引擎时遇到了类似的错误。这些消息非常烦人,因为它们使控制台变得混乱。任何帮助将不胜感激。
-
可能只是在这里采摘稻草,但您谈论“全屏”呈现它,然后说您正在使用 UIModalPresentationPageSheet。如果你想做全屏显示,你不想使用 UIModalPresentationFullScreen 吗?
-
关于找到解决此问题的任何更新?
-
这是苹果需要修复的错误。请欺骗我的雷达。 openradar.appspot.com/radar?id=1721401
标签: ios uiwebview ios5 html5-video modalviewcontroller