i am developing an app with the implementation of MPMoviePlayerViewController. there is a uitableview with links of videos that will play in it but problem is my first video plays well i tap done from player it came back then i tap on second video it plays but when i tap done it shows this: "attempt to dismiss modal view controller whose view does not currently appear." and screen goes black app doesnt terminate but just a black screen. i will show you my code.
.m file
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
player = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:[[rssOutputData objectAtIndex:indexPath.row]xmlvideo]]];
[player.moviePlayer prepareToPlay];
[player.view setFrame: self.view.bounds];
[self presentMoviePlayerViewControllerAnimated:player];
[self.view addSubview: player.view];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayerDidExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(MPMoviePlayerDidExitFullscreen:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[player.moviePlayer play];
}
- (void)MPMoviePlayerDidExitFullscreen:(NSNotification *)notification{
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerDidExitFullscreenNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
[player.moviePlayer stop];
[player.moviePlayer.view removeFromSuperview];
}