30

I'm using Xcode 9.0.

My pod file:

pod 'Alamofire', '~> 4.3'
pod 'SwiftyJSON'
pod 'AlamofireSwiftyJSON'
pod 'KSToastView', '0.5.7'
pod 'SDWebImage', '~> 4.0'
pod 'NVActivityIndicatorView'   
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'CarbonKit'
pod 'SBPickerSelector'
pod 'SwiftyStoreKit'    
pod 'Fabric'
pod 'Crashlytics'
pod 'SAMKeychain', '1.5.2'

My error log:

ld: could not reparse object file in bitcode bundle: 'Invalid bitcode version (Producer: '902.0.39.2_0' Reader: '900.0.37_0')', using libLTO version 'LLVM version 9.0.0, (clang-900.0.37)' for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I read many articles for this issue but I'm not able to solve it. I referred to this, and yes, this takes note that I want to build archive my project with

configuration = Debug
ENABLE_BITCODE = YES
configuration = Release
ENABLE_BITCODE = YES
completeSettings = some
ENABLE_BITCODE = YES

Any suggestions?

Pang
  • 9,564
  • 146
  • 81
  • 122
Himanshu Moradiya
  • 4,769
  • 4
  • 25
  • 49
  • 1
    Possible duplicate of [error: Invalid bitcode version (Producer: '800.0.35.0\_0' Reader: '703.0.31\_0')](https://stackoverflow.com/questions/38875117/error-invalid-bitcode-version-producer-800-0-35-0-0-reader-703-0-31-0) – Cœur Oct 09 '18 at 08:33

8 Answers8

46

Steps to solve this issue:

  • Build Setting
  • Search Enable Bitcode option in Build Options category.
  • Select no.
Pang
  • 9,564
  • 146
  • 81
  • 122
Ashish Singh
  • 532
  • 4
  • 4
  • 1
    Very helpful answer, thanks! I set it to No and built an Archive. Then upgraded my Xcode version and was able to build an Archive again. – Lucy Nov 03 '19 at 13:14
  • 9
    I believe this is not a real solution but workaround. You just disabled bitcode in entire project. – Yucel Bayram Jan 09 '20 at 13:15
  • 3
    Apple now suggests bitcode to be turned on. Disabling it does not really resolve this problem. – Ting Yi Shih May 26 '20 at 06:51
  • This is not an answer. It just turn off the bitcode. watchOS and tvOS app require bitcode. – winner.ktw Jun 18 '21 at 09:24
20

This is because you have some dependencies in your project (frameworks) that is built with a newer version of Xcode.

You have to update your Xcode version, or disable bit code in your project (Project > Build Settings > Enable Bitcode = NO)

enter image description here

Mourad Brahim
  • 531
  • 2
  • 15
17

This could also happen if you have two different Xcode versions installed side by side and then building with one that points to wrong command line tools. I experienced this problem after installing Xcode 10.1 next to (updated) Xcode 10.2. My Xcode 10.1 was pointing to Xcode 10.2 command line tools, so linking failed with invalid bitcode version, same as in your case. The fix was:

  • Change Command Line Tools in Xcode Preferences -> Locations -> Command Line Tools: XCode Preferenes -> Locations

  • Clean build folder and hit Archive.

The above is also valid for other Xcode versions.

  • 4
    Setting Bitcode to No doesnt allows upload of dysm file to upload on tesflight which is not a correct option. I believe this on is the correct answer. – Leena Dec 02 '19 at 09:51
  • I had installed 3 Xcode 10.3, 11.4 & 12.4, Command line tools were set to 12.4, which making problem, My project last time compiled & uploaded using Xcode 10.3, Now after 2 years, I am archiving new build using Xcode 12.4, which must (Expectedly) throw this error. – Nasir Dec 24 '21 at 05:38
5

As Rivera said, some libraries you use expect Xcode 10 (probably Firebase). So the workaround is to downgrade versions of your libraries. For me those versions works well with Xcode 9 and bitcode enabled option:

  pod 'Firebase/Core', '~> 4.13.0'
  pod 'Fabric', '~> 1.7.0'
  pod 'Crashlytics', '~> 3.9.0'

Probably you should also investigate which old version of Firebase/Messaging to use.

BTW, that is one of the reasons why developers should avoid using pods without specifying the specific version (which will lead to always download the latest versions of pods). It also may lead to version incompotability with your code which is using pod features.

SerhiiK
  • 781
  • 8
  • 12
1

Some libraries you use expect Xcode 10 (probably Firebase). Use Xcode 10.

Rivera
  • 10,792
  • 3
  • 58
  • 102
  • 1
    yes might be but i don't want to upgrade my Xcode because its affect my older project so. – Himanshu Moradiya Sep 21 '18 at 03:45
  • It shouldn't. Upgrading Xcode doesn't update your Swift version, files format or changes any build parameter. Just give it a try and ignore any suggested new settings. – Rivera Sep 21 '18 at 12:18
0

There is a big chance that the Xcode version that compiled the pod sdk is higher than the one you are using.

Next possible reason is the bitcode in build settings. Check if it is enabled on your app target and your framework target. If you have added vis cocoapods, click on pods project, under targets section, scroll down to the sdk which is giving this error, open the build settings and check for the bitcode status.

In my case, the Main project had bitcode disabled and the sdk inside the pods project had it enabled. Disabled it and everything worked fine.

abhimuralidharan
  • 5,752
  • 5
  • 46
  • 70
0

To anyone experiencing this still, you might have packages/pods built with a higher version of Xcode than you installed. I've resolved it by upgrading my XCode to the latest.

I don't think turning off the Bitcode option is the right way to go about it. It's a symptom, not the solution.

Adam
  • 3,815
  • 29
  • 24
0

Work for me set the option

ENABLE_BITCODE=no

will successfully run the build but this is NOT a good workaround.

(You have to go to the in xcode to the project>build settings, and select the "All" filter, then search by ENABLE_BITCODE key and change it)

Cristian Zumelzu
  • 842
  • 10
  • 15