ios - MPMoviePlayerController 模拟器崩溃

标签 ios xcode ios-simulator mpmovieplayercontroller

当我尝试播放任何视频时,我的 MPMoviePlayerController 崩溃了。

这只发生在模拟器上,在设备上工作正常。

错误如下:

2012-10-25 16:46:24.033 TheFasterChef[8529:14303] [MPAVController] Autoplay: Disabling autoplay for pause
2012-10-25 16:46:24.035 TheFasterChef[8529:14303] [MPAVController] Autoplay: Disabling autoplay
2012-10-25 16:46:24.172 TheFasterChef[8529:14303] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2012-10-25 16:46:24.190 TheFasterChef[8529:14303] [MPAVController] Autoplay: Enabling autoplay
2012-10-25 16:46:24.227 TheFasterChef[8529:14303] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2012-10-25 16:46:24.227 TheFasterChef[8529:14303] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2012-10-25 16:46:24.232 TheFasterChef[8529:14303] [MPAVController] Autoplay: Enabling autoplay
2012-10-25 16:46:24.238 TheFasterChef[8529:14303] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0

我的代码是调用 MPMoviePlayerController 的标准方法:

在 .h 文件中:

@property (retain) MPMoviePlayerController *videoPlayer;

在 .m 文件中:

NSBundle *appBundle = [NSBundle mainBundle];
//NSString *contentURLString = [appBundle pathForResource:videoIdentifier ofType:@"mp4"];
NSString *contentURLString = [appBundle pathForResource:@"test" ofType:@".mp4"];
NSURL *contentURL = [NSURL fileURLWithPath:contentURLString];

self.videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:contentURL];
[self.videoPlayer prepareToPlay];
[self.videoPlayer.view setFrame: self.view.bounds];
[self.view addSubview:self.videoPlayer.view];
[self.videoPlayer prepareToPlay];
[self.videoPlayer play];

我在不同的 View Controller 中尝试过这段代码,但结果相同。

我在一个新项目中尝试了这段代码,它工作正常。

还有什么可能导致此错误?

答案here没有帮我解决。

最佳答案

解决方案:从断点选项卡中删除“所有异常”。
这个答案来自 Till 上面的评论。我有这个问题,我几乎错过了答案,因为它是一条评论。 Till 的回答对我有帮助,所以我希望这对像我这样的人有帮助。

exception

关于ios - MPMoviePlayerController 模拟器崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13072580/

相关文章:

objective-c - iOS 应用中的文本阅读体验

ios-simulator - 模拟器意外退出报错,Springboard 启动失败错误 : -3

ios - 应用程序不要求 iOS 6 上的联系人访问权限

ios - 使用数组和字典以正确的 JSON 格式设置数据

xcode - 在cocoa应用程序中创建菜单和子菜单

swift - 文档文件夹在模拟器中工作但不适用于 iPad - Swift 2.1

objective-c - 如何让 iPhone 应用程序在方向变化时正确调整大小?

objective-c - iOS 项目中的未知接收者 'jsonParser' 错误

c++ - Zxing - 我在哪里可以找到这些文件? zxing-all-in-one.cpp 和 zxing-all-in-one.h

ios - UITextField 上的键盘关闭但无法单击其他 UITextField