MPMoviePlayerViewController dissappears right after trying to show up

I was having troubles showing a simple MPMoviePlayerViewController… digging into stackoverflow everything pointed me to an issue of iOS 6 about rotations, and viewWillAppear/viewWillDisappear methods that are called from the root view controller.

What it actually was… was much more simpler than all this (now… after 2 hours of research..), this stackoverflow answer pointed me to the correct solution

I was using

[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:path]];

instead of:

[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];

This is how it should look like

NSString *path = [[NSBundle mainBundle] bundlePath];

path = [path stringByAppendingPathComponent:@"test.mp4"];

self.moviePlayerViewcontroller = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:path]];


Worst thing…  the error messages: NOTHING AT ALL

Leave a Reply

Your email address will not be published. Required fields are marked *