iphone - MPMoviePlayerController - 如何编写也适用于旧版本 iOS 的代码

发布于 2024-10-08 19:08:37 字数 198 浏览 0 评论 0原文

我在我的应用程序中使用 MPMoviePlayerController 。 当我在 iOS 4.2 设备上运行该应用程序时,它运行良好。 但是,当在 iOS 3.1.3 设备上运行时,它会崩溃,说明旧版 iOS SDK 中不提供持续时间、controlStyle 等。我将目标部署设备设置为3.1。 它的建筑很好。 我应该怎么做才能让我的应用程序在最新和旧的 iOS 上播放视频。

I'm using MPMoviePlayerController in my application.
When I ran the application on iOS 4.2 device, its working fine.
But when running on iOS 3.1.3 device its crashing saying that duration, controlStyle etc are not available in older iOS SDK. I set the target deployment device to 3.1.
Its building well.
What should I do to make my app play video on latest as well as old iOS.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

遗心遗梦遗幸福 2024-10-15 19:08:37

您可以通过 [[UIDevice currentDevice] systemVersion] 检查当前的 iOS 版本,并且在旧版本上不要使用会导致错误的属性。

You can check current iOS version via [[UIDevice currentDevice] systemVersion], and on older versions don't use that properties which causes an error.

鹿童谣 2024-10-15 19:08:37

如果您查看文档,您将看到:

controlStyle
The style of the playback controls.

@property(nonatomic) MPMovieControlStyle controlStyle
…
Availability
Available in iOS 3.2 and later.

我遇到了同样的问题,并发现如果您将部署目标设置为 3.0,它不会检查 3.0 功能。

我所做的检查是将项目 Base SDK 设置为 3.0(可以一直保持在 3.0)并将目标的 Base SDK 设置为 3.0(必须设置回 4.0,否则我会收到一些奇怪的警告) 。如果您将目标 Base SDK 设置为 3.0,那么 XCode 将检查您的所有函数是否存在于 iOS SDK 3.0 中。

如果您在 Base SDK 中没有选择 SDK 3.0 的选项,则必须下载旧的 XCode 版本并手动安装 SDK。 (打开 DVD goto /packages 并安装模拟器和设备的 SDK 3.0)

If you look in the documentation you will see:

controlStyle
The style of the playback controls.

@property(nonatomic) MPMovieControlStyle controlStyle
…
Availability
Available in iOS 3.2 and later.

I had the same problem and figured out that it doesn't check on 3.0 functions if you set the deployment target to 3.0.

What I have done to check it I set the project Base SDK to 3.0 (which can stay all the time on 3.0) and set the Base SDK of my target to 3.0 (this must set back to 4.0 because otherwise I get some strange warnings). If you set your target Base SDK to 3.0 then XCode will check if all your functions exist in iOS SDK 3.0.

If you don't have the option to choose SDK 3.0 in Base SDK you have to download an old XCode version and install the SDK manually. (open DVD goto /packages and install SDK 3.0 for Simulator and Device)

涫野音 2024-10-15 19:08:37

您可以在这里查看信息。

但是,如果您使用嵌套控制器,则由于模态视图控制器的原因,某些功能(例如分页)将无法工作。应该正确分配代表,但我不知道如何分配。如果有人知道,请提供一些指导。

You can check info here. http://iosdevelopertips.com/video/getting-mpmovieplayercontroller-to-cooperate-with-ios4-3-2-ipad-and-earlier-versions-of-iphone-sdk.html#comment-36453

But, if you use nested controller, then some function such as paging will not work because of the modal view controller. The delegate should be assigned properly, but I don't know how to assign that. If anyone knows, please provide some instructions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文