Iphone 电影播放器未完成通知在iOS SDK中未触发

Iphone 电影播放器未完成通知在iOS SDK中未触发,iphone,ios,objective-c,mpmovieplayercontroller,Iphone,Ios,Objective C,Mpmovieplayercontroller,我播放了电影,但电影结束后,无法调用该方法。 我的代码如下: MPMoviePlayerViewController *pv=[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:[[arr_videos objectAtIndex:indexPath.row]valueForKey:@"Video_path"]]]; MPMoviePlayerController *pc=[pv movie

我播放了电影,但电影结束后,无法调用该方法。

我的代码如下:

MPMoviePlayerViewController *pv=[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:[[arr_videos objectAtIndex:indexPath.row]valueForKey:@"Video_path"]]];

MPMoviePlayerController *pc=[pv moviePlayer];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:pv];

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

[pc prepareToPlay];

[pc play];

将此代码用于媒体播放器

MPMoviePlayerController* theMovie=[[MPMoviePlayerController alloc] initWithContentURL:URL or Path of file];
    theMovie.scalingMode=MPMovieScalingModeAspectFill;

    theMovie.view.frame = CGRectMake(60, 20, 700, 500);
    theMovie.view.center = self.view.center;

    [self.view addSubview:theMovie.view];

    // Register for the playback finished notification. 

    [[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(onStop) 
                                                 name:MPMoviePlayerPlaybackDidFinishNotification 
                                               object:theMovie];



-(void)onStop
{
    NSLog(@"Movie Stopped");
}

谢谢你的回复。。。!!但它只显示黑屏和视频未播放[需要使用Movie play]来播放。是的,已经尝试过了,但得到了相同的结果。如果我使用
movieplayervewcontroller
,那么它可以正常播放,但是没有调用委托方法。我已经在一个我的应用程序中实现了它,并且工作正常。那么我该怎么办??