My app plays a video in fullscreen mode when the app is started. Everything is working flawlessly from 3.0 to 4.1.
However, if I compile the same code for a universal app, it will work on the iPad, but will not work on the iPhone (simulator) anymore.
Has anyone solved this problem?
Here's the code:
if ([self respondsToSelector:@selector(presentMoviePlayerViewControllerAnimated:)]) {
videoPath = [[NSBundle mainBundle] pathForResource:@"portrait" ofType:@"mov"];
videoURL = [NSURL fileURLWithPath:videoPath];
MPMoviePlayerController *aMoviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
self.moviePlayerController = aMoviePlayerController;
[aMoviePlayerController release];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startVideo:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil];
[moviePlayerController.view setFrame:self.view.bounds];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.controlStyle = MPMovieControlStyleNone;
} else {
//OS < 3.2
videoPath = [[NSBundle mainBundle] pathForResource:@"landscape" ofType:@"mov"];
videoURL = [NSURL fileURLWithPath:videoPath];
MPMoviePlayerController *aMoviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
self.moviePlayerController = aMoviePlayerController;
[aMoviePlayerController release];
moviePlayerController.movieControlMode = MPMovieControlModeHidden;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(startVideo:) name:MPMoviePlayerContentPreloadDidFinishNotification object:nil];
}
And here's the error:
-[MPMoviePlayerControllerOld view]: unrecognized selector sent to instance
0x7924470
Even if I try to prevent this like so...
if ([moviePlayerController respondsToSelector:@selector(view)]) {
[moviePlayerController.view setFrame:self.view.bounds];
}
...the error is still thrown.