如何使用 XCode 4 定位 4.2 版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5253695/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:25:29  来源:igfitidea点击:

How to target 4.2 version with XCode 4

iphonexcode

提问by Jonas Anderson

I've upgraded to XCode 4 which comes with the 4.3 version of the SDK.

我已经升级到 4.3 版 SDK 附带的 XCode 4。

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 中是否有可以配置的设置,以便我们不必强制升级每个人?

回答by RedBlueThing

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.
  • Deployment Target : Code will load on this and later versions of iOS.
  • 基础 SDK :构建期间使用的基础 SDK 的名称或路径。
  • 部署目标:代码将在此版本和更高版本的 iOS 上加载。

The first sets the SDK that you link against and the second sets the iOS versions that your app will support. It is important to understand this note on the Deployment Targetsetting:

第一个设置您链接的 SDK,第二个设置您的应用程序将支持的 iOS 版本。了解有关部署目标设置的此注释很重要:

Framework APIs that are unavailable in earlier versions will be weak-linked; your code should check for null function pointers or specific system versions before calling newer APIs.

早期版本不可用的框架 API 将是弱链接的;在调用较新的 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 版本。

回答by Sean S Lee

You should always set base sdk as the latest version, then the lowest supported version is determined by "deployment target" setting.

您应该始终将基础 sdk 设置为最新版本,然后由“部署目标”设置确定支持的最低版本。

As long as deployment target is set to at/below 4.2, it should be fine..

只要部署目标设置在/低于 4.2,它应该没问题..