我有一个导航控制器,可以推送播放视频文件的另一个视图。一切都很好,在模拟器上没有任何问题。问题是当我在iPhone上测试应用程序时,电影播放效果不错但是如果我按下iPhone上的主页按钮然后再次启动应用程序我在Xcode调试区域收到以下警告:
2011-11-21 20:23:05.216 KMW [324:707] MP _playbackInterruptionDidEndNotification :: NSConcreteNotification 0x164e90 {name = AVController_PlaybackInterruptionDidEndNotification; object =; userInfo = { “AVController_InterruptionStatusNotificationParameter”=“non-resumable.SoloAmbientSound”; “AVController_InterruptorNameNotificationParameter”=“AudioSession-324”; },_state = 0
虽然出现了此警告,但我可以继续使用该应用程序并观看电影而不会出现任何问题,但我担心在某种情况下此警告会导致问题。以下是我如何设置播放电影的视图:
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
NSString *path = [[NSBundle mainBundle] pathForResource:@"movieFileName" ofType:@"m4v"];
movieURL = [NSURL fileURLWithPath:path];
self.moviePlayer = [[[MPMoviePlayerController alloc] initWithContentURL:movieURL] autorelease];
[self.view addSubview:moviePlayer.view];
moviePlayer.view.frame = CGRectMake(0, 10, 320, 181);
[moviePlayer setControlStyle:MPMovieControlStyleNone];
[moviePlayer play];
}
- (void) viewWillDisappear:(BOOL)animated
{
[moviePlayer stop];
[moviePlayer.view removeFromSuperview];
}
- (void)dealloc
{
[movieURL release];
[moviePlayer release];
[super dealloc];
}
关于这个奇怪警告的任何想法?