How to check the iOS SDK version used to compile .ipa or .app file
If the app is your own and you have access to appstoreconnect you can look at the build that you uploaded and infer the IOS SDK From that. Within App Store Connect click the build for your app and you will see Build SDK as one of the fields for that build.
You can then check https://xcodereleases.com/ and you will see that Build SDK under the IOS SDKs column. Click the release notes link in the last column and that will bring you to the release notes for that version of XCode which includes the SDK information.
There is another way to do it: open Info.plist
plutil -p Payload/APPNAME.app/Info.plist | grep DTSDKName
That gives you result like:
"DTSDKName" => "iphoneos7.0"
P.S. This way works for very ancient apps too.
Yes. First copy the ipa to a safe location like /tmp
and unzip it:
cd /tmp/
cp ~/Music/iTunes/Mobile\ Applications/APPNAME.ipa .
unzip APPNAME.ipa
Then use otool
to see what framework versions it links:
otool -L Payload/APPNAME.app/APPNAME
This will give you results like:
Payload/APPNAME.app/APPNAME (architecture armv7):
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.8.0)
/System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 992.0.0)
/System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 2372.0.0)
/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 600.0.0)
/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox (compatibility version 1.0.0, current version 359.0.0)
/System/Library/Frameworks/MediaPlayer.framework/MediaPlayer (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0)
/System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 499.0.0)
/System/Library/Frameworks/CoreLocation.framework/CoreLocation (compatibility version 1.0.0, current version 1491.2.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 173.8.0)
/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 793.0.0)
This information may be repeated for different architectures.
For each framework, the "current version" is an internal version number that corresponds to the SDK used when compiling the app. For Foundation.framework you can look these up in NSObjCRuntime.h
. It contains a bunch of named constants that translate between iOS (or OS X) versions and the version number that otool
gives you. For example:
#define NSFoundationVersionNumber_iOS_5_0 881.00
#define NSFoundationVersionNumber_iOS_5_1 890.10
#define NSFoundationVersionNumber_iOS_6_0 993.00
#define NSFoundationVersionNumber_iOS_6_1 993.00
The constants don't include the current iOS version. You can find that at run time. Create a new test project and add this line somewhere:
NSLog(@"Foundation version: %f", NSFoundationVersionNumber);
That'll print out the current value. On iOS 7.0.4 I get 1047.220000. (This works for any version of iOS and Foundation, but it's easier to look up the values in the header file when possible).
The numbers don't always match exactly, because there aren't constants for every minor point release of iOS. But both version numbers increase over time. In this case the "current version" above is 992.0.0, and I happen to know that this app was compiled for iOS 5.1.1. Depending on the current version you see, you may have to do similar interpolation. For comparison, on another app that I know was last built several years ago, the foundation version is 678.24.0. Looking this up confirms the app's age:
#define NSFoundationVersionNumber_iPhoneOS_2_0 678.24
It's probably possible to look up version numbers for other frameworks, but I haven't tracked down the appropriate header files for them. If what you want is the SDK version, the Foundation version will tell you what you want to know.
Addendum: Matt Stevens pointed out to me that it's also possible to look up the version more directly by doing this:
otool -l Payload/APPNAME.app/APPNAME | fgrep --after-context=3 LC_VERSION_MIN_IPHONEOS
That gives you results like:
cmd LC_VERSION_MIN_IPHONEOS
cmdsize 16
version 5.0
sdk 6.0
This doesn't work in the ancient iPhone OS 2.0 app I mentioned above, but it does work on everything else I've tried. I don't know what version this was added for, but it should work for nearly every app you encounter.