Search code examples
iosxcodecompiler-warningsdeployment-targetbase-sdk

How to know which API cannot be used in which iOS SDK?


An Xcode project has the following settings:

  • Deployment target: iOS 9.0
  • Base SDK: iOS 9.3 (latest)

As I understood it, the app can be installed on iOS 9.0 and possibly try to access an API that is only available since iOS 9.3. In that case the app would crash.

So how do I easily find out which APIs that are accessed by the app are not available in any version between the deployment target and the version previous to the base SDK? Since the deployment target is known to the compiler, shouldn't it issue a warning when an API is used in code that will obviously crash the app when run on an iOS version below it's introduction?


Solution

  • You check this in the header files.

    The API doesn't change between iOS 9 and iOS 9.3, so you are safe. On the other hand, people using iOS 8 can't run your app which means fewer users, fewer sales, less money.

    If you deployed on 8.0, you could easily verify at compile time whether you use some new APIs by temporarily changing the base SDK to 8.0. In that case, you would have to make sure not to call any iOS 9 methods on iOS 8.