71

I just got this error when submitting an app to the app store.

enter image description here

Does this mean I need to set ENABLE_BITCODE for all dependencies? I tried that but then got errors saying the dependencies were not compatible with bitcode (or something like that)...

Nuno Gonçalves
  • 5,127
  • 6
  • 39
  • 58

7 Answers7

65

I had the same problem earlier this morning. In fact the answer is in the error : "Verify that all of the targets for a platform have a consistent value for the ENABLE_BITCODE build settings"

I had a target (with ENABLE_BITCODE set to NO), using multiple pods having ENABLE_BITCODE set to YES. So, all I had to, do is set ENABLE_BITCODE to YES in my project target. But I guess you have a choice, you can also set ENABLE_BITCODE to NO in all the libs your are using.

Guillaume L.
  • 939
  • 7
  • 14
  • 1
    I updated the build settings of the project as I mentioned on my question's comments. But I'm wondering, where do I find build settings for specific libraries? I searched for ENABLE_BITCODE on the whole project and I found only the one from the main project target. – Nuno Gonçalves Jun 03 '16 at 15:11
  • 1
    It depends on the way you used to import your libs. For me, since I am using Cocoapods, in my workspace, I have a pods project. When I click on my pods project I have all targets available. – Guillaume L. Jun 03 '16 at 15:19
  • Damn. I'm so stupid sometimes. I was searching withing the pods project, instead of the itself... I think sometimes my brain freezes. :D – Nuno Gonçalves Jun 03 '16 at 15:21
  • All my libs are using bitcode. I guess for not I'll let it set to yes as it has some optimizations on the app store. Or so I read. Thanks again. :) – Nuno Gonçalves Jun 03 '16 at 15:23
  • 1
    Happy to help! Same for me, all my libs use bit code so it was easier to update my project instead of all pods :) Now prepare yourself for the next problem : PIE warnings ;) – Guillaume L. Jun 03 '16 at 15:32
  • Yes. I already got the email from apple about that. I guess they were changing things today. :) And if we don't take care of the PIEs, one of these days it'll stop working again. – Nuno Gonçalves Jun 03 '16 at 15:34
  • I am too having same issue here, unfortunately i am on Xcode 6.4 and cannot find any ENABLE_BITCODE setting ! Need help if anyone here have some solution, thanks in advance ! – dip Jun 10 '16 at 04:12
  • ENABLE_BITCODE is a new feature of Xcode 7 : http://stackoverflow.com/a/30831010/6420110 You should upgrade to Xcode 7 – Guillaume L. Jun 10 '16 at 08:26
  • "If you provide bitcode, all apps and frameworks in the app bundle (all targets in the project) need to include bitcode." : https://developer.apple.com/library/tvos/documentation/IDEs/Conceptual/AppDistributionGuide/AppThinning/AppThinning.html#//apple_ref/doc/uid/TP40012582-CH35-SW2 – Kaptain Jun 15 '16 at 09:16
  • Error most likely coming from google and facebook pods – thibaut noah Jun 02 '17 at 09:01
64

The easiest and most common fix:

You can uncheck "Include Bitcode" when submitting the app via Xcode. uncheck the box

If you use xcodebuild, you can use pass an exportOptionsPlist with the value of uploadBitcode set to false. In my case, we're using xctool to build the app and don't have the ability to pass an exportOptionsPlist, so we had to remove bitcode from all of our frameworks.


If anyone is using cocoapods and wants to disable bitcode for their frameworks, you can just add the following 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

Via https://stackoverflow.com/a/32685434/1417922


To add a little more clarification as to what's going on with this issue:

It seems that apple just started enforcing this yesterday. If your main binary has bitcode disabled, but you include a static library or framework that has bitcode enabled, it will fail validation. It goes the other way too: if your main binary has bitcode enabled, but you include a library/framework that has bitcode disabled, it will fail validation.

I had a few dependencies from GoogleMaps and Amazon that made it non trivial to switch everything to enable bitcode, so I simply disabled it and removed bitcode from one static library I had imported in my project. You can strip bitcode from any binary by using this following command

$ xcrun bitcode_strip -r {Framework}.dylib -o tmp.dylib
$ mv tmp.dylib {Framework}.dylib

https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html

While the above are solutions to the problem, I don't agree that if the main binary has bitcode disabled that all of the included binaries should need it as well. Bitcode is just some IR code that Apple can use for app thinning--why don't they just strip it from other binaries (which I assume is what they previously did)? This doesn't make a ton of sense to me.

Apple thread https://forums.developer.apple.com/thread/48071

Cœur
  • 32,421
  • 21
  • 173
  • 232
Mike Sprague
  • 3,197
  • 1
  • 20
  • 25
  • 1
    This was what was needed for me as well. We use two pre-compiled binary libraries, one has bitcode enabled, the other bitcode disabled. And no way to re-compile either of them in order to match the setting! – Jeff Lockhart Jun 08 '16 at 20:48
  • Thanks a lot, really helpful! – Svitlana Jun 12 '16 at 20:13
  • 2
    If you have a WatchApp then this will not work, since you HAVE to submit the bitcode for the WatchApp – RPM Jun 28 '16 at 17:24
5

I just unchecked "include bitcode" and it started to upload

Yestay Muratov
  • 1,188
  • 2
  • 14
  • 26
3

For Carthage

  1. Open your libraries in your project folder (Carthage->Checkouts->[lib name])
  2. Then open each lib in Xcode
  3. Set Enable Bitcode - No in build settings enter image description here
  4. Do it for each lib in your list
  5. Build carthage carthage build --platform xxx

Then you can archive and submit to the Appstore successfully

Dimuth Lasantha
  • 575
  • 1
  • 8
  • 31
1

We were getting same error "Xcode - Error ITMS-90635 - Invalid Mach-O in bundle - submitting to App store" from last friday (3-june-2016) .. used the below mentioned 2 steps to get this done

Step 1:
Added code to pod file to mark 'ENABLE_BITCODE' = 'NO' in pods

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

Step 2:
Marked 'ENABLE_BITCODE' = 'NO' in pods for the project

Note: Tried with marking 'ENABLE_BITCODE' = 'YES' in pods and in my project too but as we are using twillio framework for calling which has a flag -read_only_relocs which does not allow compilation with 'ENABLE_BITCODE' = 'YES'. So if your app does not use any of such framework with -read_only_relocs then you can proceed with making 'ENABLE_BITCODE' = 'YES' as it will be good for your app.

Kara
  • 5,650
  • 15
  • 48
  • 55
Swapnil
  • 11
  • 3
0

For those who are having build error after setting "Enable BitCode" to Yes. I have to update all the library.But,the easiest part is I use Cocoapods.So,please update all your pod project : (One by one) or All

Then set Enable BitCode to "No" before you archive.

Then Archive>>Upload>>It will pass this error.

Cheers.

Thiha Aung
  • 4,656
  • 7
  • 34
  • 73
0

I had the same issue with project "ENABLE_BITCODE = YES" and dependencies "ENABLE_BITCODE = YES" on my CI with Xcode 7.3. Solution was updating Xcode to latest available version (7.3.1)

iuriimoz
  • 501
  • 6
  • 8