It's pretty straight-forward to determine the Deployment Target for an app at compile time with the macro __IPHONE_OS_VERSION_MIN_REQUIRED. It's also straight-forward to find the current iOS version the app is running on at runtime. I'm trying to figure out the deployment target of an app at runtime. I need to use this in a framework that's already compiled. Is there a public API method to determine this? I'm not able to find one.
Just to be clear. I'm looking to get the Deployment Target for an iOS app at runtime from my framework. NOT compile time. In my framework I need to alert the user of the framework that certain features will not work if their deployment target is too far back.
I get that is easy to do while compiling but my framework is already compiled and I don't want to require the user of the framework to add a macros to their code for my framework to determine their deployment target.
LSMinimumSystemVersion
, but that can be manually changed to not match the Deployment Target. – MetaphrastLC_VERSION_MIN_MACOSX
Mach-O loader command, which is reachable from the Mach-O header accessible using_dyld_get_image_header(0)
. You would use the Mach-O structures defined in /usr/include/mach-o/loader.h to parse the load commands. – Hecht