How can you disable bitcode for your project and cocoapod dependencies? Here is the error I get when trying to run my project with Xcode 7.
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 arm64
Edit: Originally only disabled it for one of the targets. Once I disabled all of them and I was able to build successfully.
To disable Bitcode, go to the Build Settings tab of your workspace, scroll down to Build Options , and set Enable Bitcode to No.
If you turn BitCode on, then the intermediate representation of the compiled program gets uploaded and Apple will able to recompile and/or optimize your apps for future architectures (as described here). Turning it off is very safe for the time being.
For iOS apps, bitcode is the default, but optional. If you provide bitcode, all apps and frameworks in the app bundle need to include bitcode. For watchOS and tvOS apps, bitcode is required. As per apple document bitcode is default but currently optional so your app will get approval until it is compulsory.
Xcode informs you regarding bitcode. Activating this setting indicates that the target or project should generate bitcode during compilation for platforms and architectures which support it. For Archive builds, bitcode will be generated in the linked binary for submission to the app store.
To set this setting in a way that doesn't get overridden each time you do a pod install
you can add this to your Podfile
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' end end end
There is a way to build CocoaPods' targets with full bitcode. Just add -fembed-bitcode
option to OTHER_CFLAGS
of each:
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)'] cflags << '-fembed-bitcode' config.build_settings['OTHER_CFLAGS'] = cflags end end end
I think this way is better than disabling bitcode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With