Search code examples
iphoneiphone-sdk-3.0mpmovieplayercontrollermpmovieplayer

MPMoviePlayerViewController crashes on OS 3.0


During the testing of my app i discovered that it crashed on an iphone with OS 3.0.1 and 3.1.1(iPod Touch).

I have the following code for playing the video which is placed on a remote server. It works flawlessly on the iOS 4.0 and iPad with OS 3.2

Xcode is setup to use SDK 4.0 but target OS is 3.0.

NSURL *url = [NSURL  URLWithString:selectedLink];  
MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url]; 
[self presentMoviePlayerViewControllerAnimated:moviePlayer];
[moviePlayer release];

When run on 3.0.1 and 3.1.1 I receive the following error:

-[UIViewController presentMoviePlayerViewControllerAnimated:]: unrecognized selector sent to instance 0x231550
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:  -[UIViewController presentMoviePlayerViewControllerAnimated:]: unrecognized selector sent to instance 0x231550'

Hope you guys can help me.


Solution

  • MPMoviePlayerViewController has been added recently and is available in iPhone OS 3.2 and later.

    You should use MPMoviePlayerController.