简体   繁体   English

为早期的iPhone OS版本构建iPhone应用程序

[英]Building iPhone app for earlier iPhone OS versions

I want to build my iPhone app to work on iPhone OS 2.0 up to 3.0. 我想构建我的iPhone应用程序,使其能够在iPhone OS 2.0(最高3.0)上运行。 According to this page , you simply need to set the "Base SDK" to 3.0 and the "iPhone OS deployment target" to 2.0. 根据此页面 ,您只需要将“ Base SDK”设置为3.0,将“ iPhone OS部署目标”设置为2.0。

My question is, when actually building the application, which "Active SDK" should I choose? 我的问题是,在实际构建应用程序时,应该选择哪个“ Active SDK”? I get the following choices: 我有以下选择:

  • 2.0 2.0
  • 2.1 2.1
  • 2.2 2.2
  • 2.2.1 2.2.1
  • 3.0 3.0

My guess is that it simply doesn't matter, but I would like to make sure. 我的猜测是,这并不重要,但我想确定一下。

You should choose the SDK you want to deploy your application to. 您应该选择要将应用程序部署到的SDK。 Compiling to a specific SDK allows you to make sure you're not using too-new features (from the developer side) and actually links the code to the right shared libraries (from the application side). 编译为特定的SDK,可以确保您没有使用过太新的功能(从开发人员方面),并且实际上将代码链接到了正确的共享库(从应用程序方面)。

You probably want to set the active SDK to 3.0. 您可能要将活动的SDK设置为3.0。 Any libraries new to the SDK 3.0, like the MessageUI.framework can be marked as weak linked in the "General" tab of the Targets info dialog. SDK 3.0的任何新库,例如MessageUI.framework,都可以在“目标”信息对话框的“常规”选项卡中标记为弱链接。 This does mean you will have to keep track of new symbols you might be using and verify they exist before attempting to call them. 这确实意味着您将必须跟踪可能正在使用的新符号,并在尝试调用它们之前确认它们是否存在。

For example to see if the new mail sending controller is available you can do: 例如,要查看新邮件发送控制器是否可用,可以执行以下操作:

Class mfMailComposeViewControllerClass = NSClassFromString(@"MFMailComposeViewController");
if(mfMailComposeViewControllerClass != nil) // SDK 3.0

This way you can make use of new features while still having backwards support. 这样,您可以在仍具有向后支持的同时利用新功能。

And BTW, it probably isn't worth it supporting pre-3.0, the bulk of potential users have already moved to 3.0, and the few iPod Touch users that haven't are probably too cheap to buy much software. 而且,顺便说一句,它不值得支持3.0之前的版本,大多数潜在用户已经迁移到3.0,并且少数iPod Touch用户可能不太便宜,无法购买太多软件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM