简体   繁体   English

如何使用XCode 4定位4.2版本

[英]How to target 4.2 version with XCode 4

I've upgraded to XCode 4 which comes with the 4.3 version of the SDK. 我已经升级到XCode 4,它附带了4.3版本的SDK。

But we'd like to make sure our app runs on devices that have 4.2 and later, not just 4.3. 但我们想确保我们的应用程序在4.2及更高版本的设备上运行,而不仅仅是4.3。

Is there a setting in XCode that can be configured so we don't have to force upgrade everyone just yet? 是否可以配置XCode中的设置,以便我们不必强制升级所有人?

There are two settings in the project settings that affect which platforms you app will support: 项目设置中有两个设置会影响您的应用支持哪些平台:

  • Base SDK : The name or path of the base SDK being used during the build. Base SDK: 构建期间使用的基本SDK 的名称或路径。
  • Deployment Target : Code will load on this and later versions of iOS. 部署目标: 代码将加载到此版本和更高版本的iOS。

The first sets the SDK that you link against and the second sets the iOS versions that your app will support. 第一个设置您链接的SDK,第二个设置您的应用将支持的iOS版本。 It is important to understand this note on the Deployment Target setting: 部署目标设置上理解此注释非常重要:

Framework APIs that are unavailable in earlier versions will be weak-linked; 早期版本中不可用的框架API将是弱链接的; your code should check for null function pointers or specific system versions before calling newer APIs. 在调用较新的API之前,您的代码应检查空函数指针或特定系统版本。

So if you are using any APIs that only exist in 4.3, make sure those frameworks are weak-linked and that your code checks the iOS version before using those APIs. 因此,如果您使用的是仅存在于4.3中的任何API,请确保这些框架是弱链接的,并且您的代码在使用这些API之前会检查iOS版本。

You should always set base sdk as the latest version, then the lowest supported version is determined by "deployment target" setting. 您应该始终将base sdk设置为最新版本,然后支持的最低版本由“部署目标”设置决定。

As long as deployment target is set to at/below 4.2, it should be fine.. 只要部署目标设置为/低于4.2,就应该没问题。

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

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