Xcode target Deployment Target vs. project Deployment Target

IphoneXcode

Iphone Problem Overview


Excuse my ignorance, but what is the difference in Xcode between the Deployment Target field under "Targets" and the deployment target under "Project"?

What happens if my project deployment target is 3.2, and my iOS Application Target is 4.0? Or vice versa?

Iphone Solutions


Solution 1 - Iphone

Target settings override project settings. Project settings are valid for all targets whose settings haven't been overridden.

Solution 2 - Iphone

UPDATE: As clarified by mr. @Edward, the version at "project" level serves as default, whereas the version at "target" level overrides the default value.

Actually it's written in the Apple docs:

> "Target settings override project settings."

The Base SDK is not related to any of this.

Original post:

Looking at the link form Apple docs ... Looks like when you set the version at "target" level you specify the minimum required version that a user can have to run your app.

On the other side, by setting the version at "project" level you specify what SDKs are available to you when you're developing. So if an API is available only to the latest version you get a compiler error notifying you that you have to handle the behaviour for missing API differently (probably using #available or @available ).

enter image description here

This is how I understand the above image:

  • you can use all APIs from major version,

  • your users can download the app only if they have at least "Deployment target" version installed

  • you can use APIs up until the "Base SDK" version

  • APIs above "Base SDK" version are not available to you in your project

Solution 3 - Iphone

The iOS Deployment Target on the Project page is the default for all targets in the project. The iOS Deployment Target on each project is an optional project-level override.

To set a target to inherit from the project, you can't use the "General → Deployment Info" section. Instead, go to "Build Settings → Deployment", and for "iOS Deployment Target" choose "Other..." and enter $(inherited).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexView Question on Stackoverflow
Solution 1 - IphoneOle BegemannView Answer on Stackoverflow
Solution 2 - IphoneAndrejView Answer on Stackoverflow
Solution 3 - IphoneEdward BreyView Answer on Stackoverflow