我开发了一个通用的应用程序,它运行在IPad和IPhone上。我在这里使用的是MPMoviePlayerController的一个组件。
现在iOS4发布了,今天我收到了一个坏消息,因为MPMoviePlayerController崩溃导致了我的应用程序被拒绝。
iDemoPlayer= [[MPMoviePlayerController alloc] initWithContentURL:aUrl];
[iDemoPlayer play];这是我播放视频的src代码。
在iPhone os 4.0版本中,我发现
“如果使用iPhone SDK3.2链接通用应用程序,则必须准备在运行iOS 4及更高版本时将电影播放器视图嵌入到界面中”
参考
http://developer.apple.com/iphone/library/releasenotes/General/RN-iPhoneSDK-4_0/index.html
你们能帮我吗,我还需要做些什么才能让它再次被接受!
谢谢,
萨加尔
发布于 2010-06-28 13:31:01
Symbian变量命名约定。
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];
}发布于 2010-07-13 23:49:00
如果您想像OS4.0之前一样继续使用全屏播放器,请按以下方式修改代码。您以前可能有两行代码如下:
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:someURL];
[moviePlayer play];您现在需要一个放置电影播放器的视图。我们假设这是在一个UIViewController中,并且使用了下面的self.view:
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];您的电影播放器现在应该继续在OS4.0和更高版本中的行为类似。
https://stackoverflow.com/questions/3130363
复制相似问题