Problem
I'm currently stuck trying to figure out what "iPhone OS Deployment Target" setting to use. 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. 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? That tool could be a good old compiler, but the latest versio开发者_Go百科n of the iPhone SDK does not come with the PRE-3.0 SDKs.
There is a way for checking desired older iOS. For example: I have installed the sdk 4.1 and tested the compiling for the 3.1 target. 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. Not only because new APIs come along, but because Apple does change the behaviour of given APIs on new iterations of the SDK unfortunately. 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.
精彩评论