21

I have just the .ipa files (I don't have the build env) without any access to the project. I'm trying to determine if they were built linking SDK 7. Is there a way or utility to check the SDK version of .ipa/.app files were compiled with?

4 Answers 4

44

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.

5
  • re: fgrep - I noticed that this does not work on apps built for the simulator. I don't see LC_VERSION_MIN_IPHONEOS in the otool output. Not trying to detract from this excellent answer in any way.
    – jmoody
    Mar 5, 2015 at 0:23
  • @jmoody it works for simulator builds for me, on my latest build it shows "version 8.3" and "sdk 8.3". What environment are you using where it doesn't work? Mar 5, 2015 at 17:31
  • Ah. Looks like maybe it is the difference between a simulator app built with mono (Xamarin) and one build with Xcode. But why that would be the case, I don't understand.
    – jmoody
    Mar 5, 2015 at 19:55
  • Interesting... Thanks. Mar 5, 2015 at 21:06
  • I've just tried this on an app built for iOS 11.1 and there's no LC_VERSION_MIN_IPHONEOS entry in the output. The answer below by @Speakus to solve this using plutil works well though.
    – Mig82
    Jan 8, 2018 at 9:21
18

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.

4
  • Didn't work for me. I got "Unexpected character Î at line". On the other hand, the accepted answer works well. Nov 6, 2014 at 10:33
  • @mrvincenzo for me this way works well always. Could you send me problem Info.plist file to look? Nov 6, 2014 at 14:50
  • This checks the SDK version used, not the minimum compatible iOS version. I have apps built using the iphoneos11.0 SDK that can run on my 8.1.2 iPhone 4S. You might want MinimumOSVersion instead.
    – Wyatt Ward
    May 17, 2019 at 20:11
  • 1
    The original question was "How to check the iOS SDK version used to compile .ipa or .app file". That is not seeking the minimum OS version.
    – ghr
    Mar 29, 2020 at 4:12
4

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.

App Store Connect Build Information

xcodereleases.com build information

1

If you have windows pc, take the iPA to windows, Unzip it (I used 7zip). Now follow the Path Unzipped folder/Payload/APP_NAME.app Open the info.plist file. It will be a xml file. Under the DTSDKName keyy you will get your sdk version.

2
  • APP_NAME.app is a folder. What do you mean Under the DTSDKName keyy, there is no key in a folder.
    – Zoli
    Jun 17, 2022 at 9:57
  • Yes APP_NAME.app is a folder. From inside the folder open info.plist. I missed to add that part. Edited my answer though. Jul 21, 2022 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.