Search code examples
iosxcodebase-sdktarget-sdk

XCode base SDK version in code


How can I get the version of the base SDK in code? I am currently building for iOS in XCode 6 and using the base SDK 8.1 . I would like to know if there is any define with the value of the SDK to be able to test it and allow building with different base SDKs.


Solution

  • This can be done using __IPHONE_OS_VERSION_MAX_ALLOWED (which is the same version as the base SDK version). That can be compared to __IPHONE_8_0 where 8_0 is the iOS release.

    For example, at this point you can use the baseSDK 8.0 or 8.1.