175

Say I set base SDK to 7, what does it mean? It could mean that the app would run on iOS 7. But that's what iOS deployment target is for.

Also why do I specify those 3 values in both project and target. It doesn't make sense. Why specify the same thing twice?

user4951
  • 32,206
  • 53
  • 172
  • 282
  • There's a good concise answer to this on another newer question: https://stackoverflow.com/a/41278576/498949 – Chris Rae Jun 07 '18 at 16:26

3 Answers3

215

In the iOS 7 TechTalk, session Architecting Modern Apps, Part 2, they explain this clearly

enter image description here

Good read Hi! I'm #available!

So, a modern App might use iOS 9 as the Target SDK, and iOS 7 as the deployment target. This means that you can run on iOS 7, iOS 8 and iOS 9, and that you have available to you any iOS 9 calls when actually running on iOS 9.

You can read more in my post SDK and Deployment Target

onmyway133
  • 45,645
  • 31
  • 257
  • 263
  • 21
    Good reference.. and this part is buried at around 25:17 in this 50 min video. – Daniel May 03 '14 at 04:45
  • 2
    Nice! But what happens if you set the Base SDK=7.0 and you try to install into iOS 8.0? Do we have to download the last XCode to support the latest Base SDK all the time? – GoRoS Sep 10 '15 at 14:02
  • 1
    @GoRoS your app won't be supported if based sdk is < iOS 8 (users can't install from app store). Since UIKit/Foundation is dynamic library, If forced via Xcode or binary things might just work but the app could crash anytime and is usually unstable. Base SDK always goes with corresponding Xcode version. However, Base SDK for Xcode is for simulator the one on device might be different. So it's important to test things on real device before you ship. That's the problem with all dynamic libraries. – Kunal Balani Aug 09 '16 at 18:31
  • Just to be totally clear: If an app is built with Base SDK 11 (the latest version currently) and iOS12 comes out, for the app to be installable on iOS12 devices I'll need to do an app update with a BaseSDK12 build of the app? And what about minor versions, e.g. is a Base SDK 11.1 app installable on an iOS 11.2 device? – chichilatte Feb 21 '18 at 16:57
  • 2
    @chichilatte no, you don't need. The app still supports iOS 12, iOS 13, ... but it won't have any new features of iOS 12, iOS 13 .... To use new feature of iOS 12, you need to compile against iOS 12 SDK and use APIs from iOS 12. – onmyway133 Feb 21 '18 at 19:06
  • 3
    Thanks, that makes sense. I think @Kunal-Balani 's comment above is wrong. – chichilatte Feb 22 '18 at 11:36
  • @chichilatte my answer stay corrected. based on your assumption apps with base sdk 6 should work on iOS 11 but that is not the case. Please read apple documentation. These are all common sense guidelines. – Kunal Balani Feb 22 '18 at 22:58
  • @Kunal-Balani "read the documentation", easier said than done! I found [one doc](https://apple.co/2oln9zP) that gets close: "As frameworks evolve through various releases, APIs are introduced or deprecated and behaviors of existing APIs may occasionally change. Apple makes every effort to minimize changes that may cause incompatibilities". It looks like they have a policy of **forward compatibility**. That is, your BaseSDK6 app will work on iOS11, but obviously you can't use any APIs from SDK7+, and look out for deprecation warnings when building yr app. Please prove me wrong if i am. – chichilatte Feb 23 '18 at 11:50
  • Ok i found the video mentioned in the answer above (new link: https://developer.apple.com/videos/play/enterprise/15 ) and they're talking about an app built with BaseSDK6 running happily on iOS7. – chichilatte Feb 23 '18 at 12:07
  • @chichilatte hahaha !! so cute. If that's the case you just write app once and it will run forever on all operating systems, apps running with plus one incremental version doesn't imply forward compatibility. Forward compatibility refers to minimizing changes to support new platform, it doesn't imply no changes at all.This has nothing to do with apple, It's basics of computer science. – Kunal Balani Feb 23 '18 at 17:51
  • 1
    @Kunal-Balani Er, look mate i'm just trying to get basic information i'm not trying to school you. All the best. – chichilatte Feb 23 '18 at 21:00
  • 2
    @Kunal-Balani, the other commenters are correct. You *do not have to recompile your app* if a newer version of the OS comes along than the one you built against *unless they have removed support for what your app currently uses*. A newer OS does not all of a sudden mean your app built against the older SDK stops working. If that was the case, no one would ever upgrade because it would mean every app they currently had would just stop working until newer versions came out which simply isn't true. – Mark A. Donohoe Feb 13 '19 at 20:37
86

The base SDK is what you build your app against (i.e. include and library files and frameworks). As you say, it doesn't affect the deployment target, except that base sdk >= deployment target.

You specify build settings on 2 levels as each project can have multiple targets and you might not want the same settings for all targets. The project-level settings override the default settings and the target-level settings override the project-level settings.

For example I have projects with both OSX and iOS targets and some are ARC and some are MRR. I'd have to have different projects for each if I was unable to specify build settings with the level of granularity that Xcode allows.

John Topley
  • 113,588
  • 46
  • 195
  • 237
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
69

Base SDK is the SDK you link against. Deployment Target is the minimum required iOS version you application needs to run. You can build an application with SDK 7 that runs under iOS 6. But then you have to take care to not use any function or method that is not available on iOS 6. If you do, your application will crash on iOS 6 as soon as this function is used.

See the apple documentation for more details: https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html

Cœur
  • 37,241
  • 25
  • 195
  • 267
V1ru8
  • 6,139
  • 4
  • 30
  • 46