Base versus Active versus Deployment target

与世无争的帅哥 提交于 2019-11-27 07:36:29
fbrereto

The difference between the Base and Active SDK is that the former is the default SDK set for the project and the latter is the SDK you are currently building against. So it is possible for your Active SDK to be the Base SDK, at which point XCode will use the SDK you specified for the project.

In order to build your app for the widest set of devices possible, you are correct:

  • Set the Base SDK to the lastest SDK possible (3.0, 3.0.1)
  • Set the Deployment Target to the earliest SDK possible (2.0)

Apple does allow you to specify iPhone 2.0 as the Deployment Target, but keep in mind any API or framework released after iPhone 2.0 you will not have available to you for use by default. There are techniques to use features from later SDKs, however they are nontrivial.

You should set the Base SDK build setting to the latest SDK that contains all of the features that you intend to use (usually, the latest available SDK), and set the "iPhone Deployment Target" build setting to the earliest version of the OS on which you want to run.

You then need to make sure that you check, at runtime, for any features that may not exist on the earlier OSes.

"Base SDK" is the Maximum SDK you application can support. There's a hard limit here - you can't select a future, unreleased SDK.

"Deployment Target" is the Minimum SDK you are willing to support. It how far back in time you are willing to go.

Xcode appear to create a spurious dependency on "Deployment Target." For example, I can't develop on my iOS 5.1.1 iPod with Xcode 4.5.2 (Xcode 4.5.2 is paired with iOS 6.0), even though the 4.3, 5.0, and 5.1 APIs and Simulators are installed on this installation. I need to use the simulator or jack in my iOS 6.0 iPhone.

The games Apple is playing appears to be causing problems with apps, too. My purchased copy of Elements will not sync via iTunes to the iPod because Elements needs a newer version of iOS to run (it syncs and runs fine on my iOS 6.0 iPhone).

I've got two iPads and one is 4.3. I shudder to think what a mess it will cause.

In general;

Set the BASE SDK to the very latest SDK you are willing to support and test.

Set the Deployment Target to the lowest version of iOS you are willing to support and test.

If you happen to use Base SDK features not available on the deployment target SDK, the app will crash at runtime on older devices, so testing is vital.

An alternative / complementary process would be to use Deploymate http://www.deploymateapp.com/ which does static code analysis to identify problems.

If you are from the android world the analogies are such;

TargetSDK -> Base SDK

MinSDK -> Deployment Target

Lint -> Deploymate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!