Thursday, February 13, 2014

[iOS] How to determine whether a static library (.a) has 64-bit slice

If you build a 64-bit version of your iOS app, be sure that any 3rd party static libraries the app link must have 64-bit slice.  Otherwise your app will still require iOS 32-bit runtime support.

How to determine whether a static library (.a) has 64-bit slice?  It's actually easy.  Just use lipo -info command but the trick is to run it under the xcrun as follows:

$ xcrun -sdk iphoneos lipo -info Pods/GoogleAnalytics-iOS-SDK/libGoogleAnalyticsServices.a

Architectures in the fat file: Pods/GoogleAnalytics-iOS-SDK/libGoogleAnalyticsServices.a are: armv7 armv7s i386 x86_64 arm64

If the result contains arm64, the static library was built with a 64-bit version (A7 chip in iPhone 5S+ and iPad Air+).  In addition, i386 and x86_64 are slices for simulator while arm7 and arm7s are for up to iPhone 4S's chips and iPhone5's A6 chip.

No comments: