“Xcode Bitcode” “iOS Architecture” “ARM64e

XXX. O was build without full bitcode error: Linker Command failed with exit code 1. Set Enable Bitcode to NO. I have a brief understanding of Bitcode, and I will introduce it to you today.

The Xcode Bitcode

  • BitcodeisXcode7New feature.
  • TARGETS -> Build Settings -> Search Enable Bitcode

The BitcodeThe official instructions:

Official: Bitcode is an intermediate representation of a compiled program. apps you upload to App Store 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 App Store. For iOS apps, bitcode is the default, but optional. For watchOS and tvOS apps, bitcode is required. If you provide bitcode, all apps and frameworks in the app bundle (all targets in the project) need to include bitcode. Bitcode is an intermediate representation of a compiled program. Apps that contain Bitcode and are uploaded to App Store Connect are compiled and linked on the App Store. Including Bitcode allows Apple to optimize your App binary again at a future time without submitting a new version of the App. For iOS Apps, Enable Bitcode defaults to YES and is optional (it can be changed to NO). For WatchOS and tvOS, bitcode is mandatory. If your App supports Bitcode, all Apps and frameworks in the App Bundle (all targets in the project) need to include Bitcode.

Looking at the above content, we can have a simple understanding of Bitcode. If we encounter an error similar to the one I encountered when using some Framework or.a in our project, we need to check whether the Framework or.A supports Bitcode.

Check whether the framework or. A file supports Bitcode and what architectures are supported:

  • Let me first introduce you to a tool:otool
  • Description:

    otool:object file display tool.

    Tool used to view object files.

To check whether the Enable Bitcode value is YES, run the following command on the terminal:

  • Otool -l framwork path under the entities file | grep __LLVM

Use otool to view the Load Commands contents of the Framework file, and then search for __LLVM in Load Commands.

If the output of the above command is __LLVM, then it indicates that the framework used or. A supports setting Enable bitcode to YES, otherwise it does not.

  • Example:
 otool -l /Users/wangyongwang/Documents/QiBitcode/QiBitcode.framework/QiBitcode | grep __LLVM
Copy the code
  1. If no result is displayed in the preceding command, the framework or. A does not support setting Enable bitcode to YES.

  2. If the following output is displayed, the framework or. A supports setting Enable bitcode to YES.

   segname __LLVM
   segname __LLVM
   segname __LLVM
   segname __LLVM
Copy the code
  • Required conditions for an App to support Enable Bitcode:
  1. Set Enable bitcode to YES in the framework or. A file.
  2. The framework used or supported by the. A file is complete;
  • So why aren’t some frameworks made to support Enable Bitcode?

I found the following information: there may be some problems on the author’s own understanding, the author will not interpret, we interpret by ourselves.

  1. Build static library or framework via Xcode 7, while user build application using Xcode 6. “Framework and library providers need to include bitcode for Xcode 7 development, and Xcode 7 generates bitcode by default. However, bitcode-enabled framework and library products do not work well with Xcode 6. If you still need to support Xcode 6 development, you must produce an additional version of your products without bitcode. To build a library without bitcode, either use Xcode 7 with the build setting Enable Bitcode disabled (ENABLE_BITCODE=NO) or use Xcode 6.”
  • Check which architectures are supported by the Framework:

Let me introduce you to LIPO

lipo : Create or operate on a universal file: convert a universal binary to a single architecture file, or vice versa. Create or operate on a generic file, convert the generic file to a separate schema file, or reverse convert the separate schema file to a generic file.

To give you an overview of the architectures supported by the View Framework, we will use Lipo Info here.

lipo infoInterpretation of the

-info Briefly list the architecture types in the input universal file. Lists the names of each archive. Simply list the schema types of the entered generic file, listing the name of each schema:

  • Usage: Lipo-info Framework or. A Entity file path
  • Example:
 lipo -info /Users/wangyongwang/Documents/QiBitcode/QiBitcode.framework/QiBitcode
Copy the code

Example results: Architectures in the fat file: / Users/wangyongwang/Documents/QiBitcode/QiBitcode framework/QiBitcode are: armv7 i386 x86_64 arm64

About Architectures:

As of 2018, Apple released the new iPhone XS, iPhone XS Max, iPhone XR, iPhone and CPU corresponding situation:

CPU iPhone
armv6 iPhone, iPhone 3G
armv7 iPhone 3GS, iPhone4(GSM),iPhone 4(CDMA),iPhone 4S
armv7s iPhone 5, iPhone 5C
arm64 iPhone 5S, iPhone SE, iPhone 6, iPhone 6 Plus, iPhone 6s, iPhone 6s Plus, iPhone 7, iPhone 7 Plus, iPhone 8, iPhone 8 Plus, iPhone X
arm64e iPhone XS, iPhone XS Max, iPhone XR

For the iPhone: The iPhone 5S used a 32-bit microprocessor before, and the iPhone 5S and later have 64-bit microprocessors

The amount of CPU used on the emulator is determined by the computer used

CPU iPhone
i386 32-bit microprocessor
x86_64 64-bit microprocessor

QiShare QiShare QiShare QiShare QiShare QiShare QiShare QiShare QiShare QiShare QiShare

IOS KVC and KVO: iOS Localization (IB) iOS Localization (NON-IB