简体   繁体   English

XCode iPhone OS部署目标工具

[英]XCode iPhone OS Deployment Target Tool

Problem 问题

I'm currently stuck trying to figure out what "iPhone OS Deployment Target" setting to use. 我目前正试图找出要使用的“iPhone OS部署目标”设置。 I do not want to write conditional code right now, so I'd like the lowest version that runs my application fine. 我现在不想写条件代码,所以我想要运行我的应用程序的最低版本。

At first I thought it would be 2.0 as I wasn't using any 3.0 features, but then i realized that AVAudioRecorder is a 3.0 API. 起初我认为它将是2.0,因为我没有使用任何3.0功能,但后来我意识到AVAudioRecorder是一个3.0 API。 I don't want to be manually checking EVERY function I use in the documentation. 我不想手动检查我在文档中使用的每个功能。

Question

Is there a tool that will check the OS availability of each functions you call in your code to figure out what the Deployment Target should be? 是否有一个工具可以检查您在代码中调用的每个函数的OS可用性,以确定部署目标应该是什么? That tool could be a good old compiler, but the latest version of the iPhone SDK does not come with the PRE-3.0 SDKs. 该工具可能是一个很好的旧编译器,但最新版本的iPhone SDK没有附带PRE-3.0 SDK。

There is a way for checking desired older iOS. 有一种方法可以检查所需的旧iOS。 For example: I have installed the sdk 4.1 and tested the compiling for the 3.1 target. 例如:我已经安装了sdk 4.1并测试了3.1目标的编译。 http://0xced.blogspot.com/2010/07/using-sdk-313-with-iphone-sdk-4.html http://0xced.blogspot.com/2010/07/using-sdk-313-with-iphone-sdk-4.html

There is no tool to do that, testing on dedicated devices is the way forward. 没有工具可以做到这一点,在专用设备上进行测试是前进的方向。

Depending on what you want to do, conditional code based on the SDK version is probably a common task on iOS development. 根据您的想法,基于SDK版本的条件代码可能是iOS开发中的常见任务。 Not only because new APIs come along, but because Apple does change the behaviour of given APIs on new iterations of the SDK unfortunately. 不仅因为新的API出现了,而且因为Apple确实在SDK的新迭代中改变了给定API的行为。 So I wouldn't be scare of branching the code when needed. 因此,我不会害怕在需要时分支代码。

There isn't such a tool. 没有这样的工具。 Your best bet is to check the docs, and test on devices with different versions of the OS installed. 最好的办法是检查文档,并在安装了不同版本操作系统的设备上进行测试。

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

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