Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 712
Scorpio Avatar asked Apr 16 '26 21:04

Scorpio


1 Answers

You can find out the version of the current Foundation framework that the code is running against by checking the value of NSFoundationVersionNumber.

If you check out the NSObjCRuntime.h you will find the various version numbers listed in there.

As in regards to building against different versions of the SDK; Apple stops App Store uploads if you don't build against the latest SDK once the cut off date has come into effect - i.e. new apps submitted now must be build against iOS 8 SDK.

What you can however do, is have a lower iOS Deployment Target (this you can find in your project's settings). This will allow for your app to run on older iOS versions, but it will still be built against the latest SDK. Do note though, it is your responsibility to ensure that you do not use any new APIs without first ensuring the current environment supports them e.g. UITextField's selectable property. If you call that whilst running on iOS 6, your app will crash.

like image 99
MultiColourPixel Avatar answered Apr 19 '26 11:04

MultiColourPixel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!