How to Check If a Framework Is Bitcode Supported for Xcode7

How to check if a framework is Bitcode supported for Xcode7

From this Apple Developers Forum discussion, user dshirley and bwilson suggest using command line tools otool and grep to check if bitcode sections exist.

$ otool -l libName.o | grep __LLVM

or

$ otool -l MyFramework.framework/Versions/A/MyFramework | grep __LLVM

Running the above command, if the library contains bitcode you will see segname __LLVM output.

How to check a framework contains full bitcode?

otool -l binary_name | grep __bitcode

you will see one or more segname __bitcode entries if it does have bitcode or empty output if does not.

I would like to know how to get option ENABLE Bitcode in XCODE 7 beta 4?

To Show Option ENABLE_BITCODE Option in Xcode 7 Use following steps,

1) Right Click On “YourProjectName.xcodeproj” file and Select “Show Package Contents” option.

2) Open “project.pbxproj” TextEdit application and add ENABLE_BITCODE = NO; in two places in project.pbxproj file as shown below,

1D6058950D05DD3E006BFB54 /* Release / = {/ Build configuration list for PBXNativeTarget "::APP_TITLE::" */
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
ENABLE_BITCODE = NO;

1D6058940D05DD3E006BFB54 /* Debug / = {/ Build configuration list for PBXNativeTarget "::APP_TITLE::" */
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
ENABLE_BITCODE = NO;

3) Save above changes in “project.pbxproj” file.

4) Open your project in Xcode 7 then you will see the option ENABLE_BITCODE under Targets => BuildSettings.

5) Set ENABLE_BITCODE = NO to Debug, Release, Distribution.

6) Build and Run your project on your device.

What does ENABLE_BITCODE do in xcode 7?

Bitcode refers to to the type of code: "LLVM Bitcode" that is sent to iTunes Connect. This allows Apple to use certain calculations to re-optimize apps further (e.g: possibly downsize executable sizes). If Apple needs to alter your executable then they can do this without a new build being uploaded.

This differs from:
Slicing which is the process of Apple optimizing your app for a user's device based on the device's resolution and architecture. Slicing does not require Bitcode. (Ex: only including @2x images on a 5s)

App Thinning is the combination of slicing, bitcode, and on-demand resources

Bitcode is an intermediate representation of a compiled program. Apps
you upload to iTunes Connect that contain bitcode will be compiled and
linked on the App Store. Including bitcode will allow Apple to
re-optimize your app binary in the future without the need to submit a
new version of your app to the store.

Apple Documentation on App Thinning

xcodebuild 7.3 can't enable bitcode

I ran into a similar issue yesterday. After some investigation, the problem, that appears when running xcodebuild from a "Run Script" build phase in any Xcode target, seems related with the explicit specification of the toolchain to be used, done with the ENV variable TOOLCHAINS.

Therefore, until Apple releases a fixed version of Xcode 7.3, you can try to add the following command at the beginning of your script:

# workaround for bitcode generation problem with Xcode 7.3
unset TOOLCHAINS

This should be harmless, as this env variable is not set by default when you run xcodebuild from the command line, and this workaround works just fine in my case.



Related Topics



Leave a reply



Submit