Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable bitcode for project and cocoapods dependencies with Xcode 7?

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.

like image 910
jherg Avatar asked Sep 17 '15 21:09

jherg


People also ask

How do I disable Bitcode?

To disable Bitcode, go to the Build Settings tab of your workspace, scroll down to Build Options , and set Enable Bitcode to No.

Is it safe to disable Bitcode?

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.

Is Bitcode required iOS?

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.

What is enable Bitcode Xcode?

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.


2 Answers

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 
like image 147
Keith Smiley Avatar answered Sep 22 '22 13:09

Keith Smiley


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.

like image 24
werediver Avatar answered Sep 19 '22 13:09

werediver