我有一个在 iOS 7 之前工作的代码,更新后电影没有播放:
-(void)setMovie:(NSURL *)newMovie autoPlay:(BOOL)autoPlay
{
movieView_ = [[MPMoviePlayerViewController alloc] initWithContentURL:newMovie];
[movieView_.view setContentMode:UIViewContentModeScaleAspectFit];
[movieView_.moviePlayer setShouldAutoplay:NO];
movieView_.moviePlayer.view.frame=self.view.frame;
[movieView_.moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[movieView_.moviePlayer setMovieSourceType:MPMovieSourceTypeFile ];
[movieView_.moviePlayer prepareToPlay];
id currentPhotoView = [photoViews_ objectAtIndex:currentIndex_];
[currentPhotoView addSubview:movieView_.moviePlayer.view];
[movieView_.moviePlayer play];
}
不知道是什么问题,应用程序没有崩溃。