【问题标题】:Video with iPhone 3.0 OS application getting crash while running in iphone 4.0 OSiPhone 3.0 操作系统应用程序在 iphone 4.0 操作系统中运行时崩溃的视频
【发布时间】:2010-08-28 09:40:17
【问题描述】:

我在 iphone 4.0 操作系统中播放视频时遇到崩溃问题。实际上,我已经使用基本 SDK 3.0 创建了应用程序,现在我只是将应用程序安装到 4.0 OS 设备。

它不起作用...我已经调试了那个问题,发现在 4.0 操作系统中,苹果更改了播放视频的框架和方法。

谁能帮我解决这个问题。

这是我在 3.0 操作系统中运行良好的代码。

-(void)play
    {
     NSBundle *bundle = [NSBundle mainBundle];
     //NSString *path = [bundle pathForResource:@"Icon" ofType:@"png"];
     NSString *path = [bundle pathForResource:@"loader" ofType:@"m4v"];
     NSURL *url = [NSURL fileURLWithPath:path];
     moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
     moviePlayer.scalingMode = MPMovieScalingModeAspectFill;

     [[NSNotificationCenter defaultCenter] addObserver:self 
                selector:@selector(moviePlayBackDidFinish:) 
                 name:MPMoviePlayerPlaybackDidFinishNotification 
                  object:moviePlayer];
     moviePlayer.movieControlMode = MPMovieControlModeHidden;
     [moviePlayer play];
    }

提前致谢, 普拉格尼什

【问题讨论】:

    标签: iphone video operating-system mpmovieplayercontroller iphone-4


    【解决方案1】:

    在 iOS4 中,您需要使用 MPMoviePlayerViewController。我发布了我的working code sample here

    【讨论】:

    • 是的,我明白,但我的基础 sdk 是 3.1.2,然后编译器给出 MPMoviePlayerViewController 错误..
    • 要兼容 iOS4,您需要将您的 xcode 升级到 3.2.3,将您的基础 SDK 设置为 4.0,然后将您的目标操作系统设置为 3.0。然后代码 sn-p 应该可以工作,并且您应该兼容 4.0 和 3.0。 MPMoviePlayerViewController 仅在 4.0 SDK 中可用。最后,Apple 希望每个人都将他们的应用程序升级到 4.0 SDK,这与您在 AppStore 中获得“在 iOS4 上测试”标签的方式不同。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-28
    相关资源
    最近更新 更多