我如何修复下面的代码,以便在模拟器中运行应用程序时不会发生断点。当我保存并运行应用程序时,它显示没有问题,但在运行进程后立即停止,并显示断点3.1 4.1错误。
#import "XYZViewController.h"
#import <MediaPlayer/MediaPlayer.h>
@interface XYZViewController ()
@end
@implementation XYZViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *movFile = [[NSBundle mainBundle]pathForResource:@"movie1" ofType:@"MP4"];
movPlayer = [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath:movFile]];
movPlayer.allowsAirPlay=YES;
[movPlayer.view setFrame:CGRectMake(0, 0, 320, 480)];
[self.view addSubview:movPlayer.view];
[movPlayer play];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end发布于 2012-10-31 08:44:49
如果您设置了断点,或者存在运行时错误,就会发生断点。如果您没有在那里设置断点,那么这是一个运行时错误。
鉴于您提到了3.1 4.1错误,这表明存在运行时错误。您应该仔细查看断点所在的行,看看是否有什么问题。另外,发布这个断点的位置也会帮助其他人帮助你。
由于不知道断点在哪里,我猜测您的电影文件名不正确(请记住iOS区分大小写),或者movie1.MP4没有添加到项目中。
https://stackoverflow.com/questions/13149519
复制相似问题