Getting EXC_BAD_ACCESS if I press Home Button in Video Player
I have an application where I need to play a video. I used following code. There is a problem with Home button, if I press the Home button during video playing I'm getting EXC_BAD_ACCESS. I even have no idea why it may happens. Please help.
NSString * videoString = [[NSBundle mainBundle] pathForResource:@"video.mp4" ofType:nil]开发者_如何学运维;
NSURL * url = [NSURL fileURLWithPath:videoString];
MPMoviePlayerController * videoPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[self.view addSubview:videoPlayer.view];
videoPlayer.view.frame = CGRectMake(0, 0,768, 1024);
[videoPlayer play];
In your application controller's applicationWillResignActive method, call [videoPlayer stop].
精彩评论