Fabrizio Bartolomucci Fabrizio Bartolomucci - 11 months ago 106
iOS Question

Xcode 7 'CrashReporter does not contain bitcode' linker error

I am directly linking PLCrashReporter in my iOS app without using any external tool and now when I try to compile it on Xcode 7 I get link error:

does not contain bitcode. You must rebuild it with bitcode enabled
(Xcode setting ENABLE_BITCODE), obtain an updated library from the
vendor, or disable bitcode for this target. for architecture armv7

Where do I get the updated framework or the sources to compile them with bitcode enabled and get rid of the error without disabling bitcode for the full project?

Answer Source

I ended up addressing this by building PLCrashReporter 1.2.1 from source. This version is the minimum that has had Xcode 7 and iOS9 fixes merged.

The source is obtained from here: PLCrashReporter 1.2.1

Unzip the downloaded 1.2.1 source into a folder.

Pull the Xcode project inside that folder up within Xcode and add the following to the Custom Compiler Settings "Other C Flags" section of the project build settings: -fembed-bitcode

Next add the following to the Custom Compiler Settings "Other Warning Flags" section of the project build settings: -Wno-error=unused-command-line-argument

Then close the project from the Xcode GUI. The custom settings are necessary because we are going to build from the command line using xcodebuild to avoid the PLCR deprecation errors, and when doing so the default is only -fembed-bitcode-marker when building a framework this way. We are overriding the default behavior, and need to suppress the hard stop warning this causes.

Lastly, from a terminal window prompt within the folder where the zip file of the source including the xcode project file is located run the following:

xcodebuild -configuration Release -target 'Disk Image'

This will run the build and leave the framework in ./build/Release/PLCrashReporter-1.2.1/iOS Framework

Now, these steps will produce a bitcode enabled framework, but third party crash reporting is incompatible with bitcode (when the App Store recompiles you have no way to get the symbol file from that on the fly build).