some_id
some_id

Reputation: 29896

Cannot dismiss a VIewController after dismissing a MediaplayerViewController

I have a view controller presenting a MediaViewController and after that I cannot get the first view to dismiss.

Apparently it might not work if both views are dismissed animated:YES, but I have tried all variants and still no luck.

I create and present the MediaPlayerViewController like so

MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:fileURL];
    [mp moviePlayer].controlStyle = MPMovieControlStyleNone;
    [[mp moviePlayer] prepareToPlay];
    [[mp moviePlayer] setShouldAutoplay:YES];
    [mp moviePlayer].fullscreen = YES;
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];

    [self presentMoviePlayerViewControllerAnimated:mp];

The following code should dismiss the views

-(void)videoPlayBackDidFinish:(NSNotification*)notification
{       
    AppstersAppDelegate *appDelegate = (AppstersAppDelegate *)[[UIApplication sharedApplication] delegate];

   // [appDelegate continueSetup];

    [self dismissMoviePlayerViewControllerAnimated];

    [appDelegate.viewController dismissModalViewControllerAnimated:NO];
}

The viewController on the appDelegate is the rootViewController

I have also tried calling dismissModalViewControllerAnimated on self, but it didnt solve the issue.

The weird thing is that this is happening with each view that is presenting a movieViewController.

Upvotes: 0

Views: 156

Answers (1)

WrightsCS
WrightsCS

Reputation: 50727

Try [self.parentViewController dismissModalViewControllerAnimated];

Upvotes: 0

Related Questions