-[UIWindow addEventMonitor:]在Iphone 3.1.3上崩溃
这是我在3.1.3上播放视频时遇到的崩溃。它在4.0上运行良好-[UIWindow addEventMonitor:]在Iphone 3.1.3上崩溃,iphone,Iphone,这是我在3.1.3上播放视频时遇到的崩溃。它在4.0上运行良好 ***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“***-[UIWindow addEventMonitor:]:无法识别的选择器发送到实例0x127500” 任何答案都会很有帮助。谢谢,在操作系统3.0+和操作系统4.0+之间播放视频的处理方式不同,您使用addEventMonitor的原因是什么 我是这样做的: -(void)playStoryMovie { NSURL *ur
***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“***-[UIWindow addEventMonitor:]:无法识别的选择器发送到实例0x127500”
任何答案都会很有帮助。谢谢,在操作系统3.0+和操作系统4.0+之间播放视频的处理方式不同,您使用addEventMonitor的原因是什么 我是这样做的:
-(void)playStoryMovie {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"campaign1" ofType:@"mp4"]];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
// Use the new 3.2 style API
moviePlayer.controlStyle = MPMovieControlStyleNone;
moviePlayer.shouldAutoplay = YES;
// This does blows up in cocos2d, so we'll resize manually
// [moviePlayer setFullscreen:YES animated:YES];
[moviePlayer.view setTransform:CGAffineTransformMakeRotation((float)M_PI_2)];
CGSize winSize = [[CCDirector sharedDirector] winSize];
moviePlayer.view.frame = CGRectMake(0, 0, winSize.height, winSize.width); // width and height are swapped after rotation
[[[CCDirector sharedDirector] openGLView] addSubview:moviePlayer.view];
} else {
// Use the old 2.0 style API, YES APPLE WE KNOW ITS DEPRECATED BUT THIS IS FOR THE OLD DEVICES.
moviePlayer.movieControlMode = MPMovieControlModeHidden;
[moviePlayer play];
}
}
- (void)moviePlayBackDidFinish:(NSNotification*)notification {
MPMoviePlayerController *moviePlayer = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
// If the moviePlayer.view was added to the openGL view, it needs to be removed
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
[moviePlayer.view removeFromSuperview];
}
[moviePlayer release];
}