tags:

views:

1704

answers:

2

Hello All,

I have developed universal application which runs on both IPad and IPhone. I am using one component of MPMoviePlayerController in this.

now the iOS4 is released, Today I got a bad news about my application rejection due to this MPMoviePlayerController crash.

iDemoPlayer= [[MPMoviePlayerController alloc] initWithContentURL:aUrl];
[iDemoPlayer play];

This is my src code for playing the video.

In iPhone os 4.0 release I found that

"If you link a Universal application against iPhone SDK 3.2, you must be prepared to embed the movie player view in your interface when running on iOS 4 and later"

ref

http://developer.apple.com/iphone/library/releasenotes/General/RN-iPhoneSDK-4_0/index.html

Can you guys help me,what else updation I need to make so that it will be accepted again!!!!!!

Thanks,

Sagar

+2  A: 

Ugh, Symbian variable naming conventions.

if ([MPMoviePlayerController instancesRespondToSelector:@selector(view)]) {
  // Running on 3.2+
  iDemoPlayer2 = [[MPMoviePlayerViewController alloc] initWithContentURL:aUrl];
  // Assuming self is a UIViewController
  [self presentMoviePlayerViewControllerAnimated:iDemoPlayer2];
  // This line might be needed
  [self.moviePlayer play];
} else {
  iDemoPlayer= [[MPMoviePlayerController alloc] initWithContentURL:aUrl];
  [iDemoPlayer play];
}
tc.
+2  A: 

If you want to continue using a full screen player as you were prior to OS 4.0, modify your code as follows. You probably previously had two lines that looked like:

MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:someURL];
[moviePlayer play];

You now need a view in which to place the movie player. We are assuming this is in a UIViewController and have used self.view below:

MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:someURL];

if ([moviePlayer respondsToSelector:@selector(view)]) {
    moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
    [moviePlayer.view setFrame:self.view.bounds];
    [self.view addSubview:moviePlayer.view];
}

[moviePlayer play];

Your movie player should now continue to behave similarly in OS 4.0 and prior.

Matt
It throws this error:-[MPMoviePlayerControllerOld setControlStyle:]: unrecognized selector sent to instance 0x8029340'
Vibhor Goyal