MPMoviePlayerViewController无法在iOS 7上运行

时间:2013-10-11 09:22:16

标签: ios objective-c ios7

我有一个代码在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];      
}

不知道,问题是什么,应用程序没有崩溃。

1 个答案:

答案 0 :(得分:0)

您实际上需要提供MPMoviePlayerViewController:

[self presentViewController: _movieView_ animated: YES completion: nil];

如果您尝试在屏幕的一部分播放,请使用MPMoviePlayerController。