9

have been struggling for few days... Basically I have build a compiled released framework and distribute it with cocoaPods. The problem is that then archiving this framework application gets the following error:

ld: bitcode bundle could not be generated because '/.../testingPodsAcrossversions/Pods/Pod/Pod.framework/Pod' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/.../testingPodsAcrossversions/Pods/Pod/Pod.framework/Pod' for architecture arm64

I have did these things:

Search for Enable Bitcode setting and set it to YES for Debug and Release modes. 

Search for bitcode settings. Add -fembed-bitcode in both Debug and Release modes or you can add -fembed-bitcode-marker in Debug and  -fembed-bitcode in Release mode.

Add BITCODE_GENERATION_MODE under User Defined setting , and then add bitcode for both Debug and Release modes or you can add markerin Debug and bitcode in Release mode.

I only need release version, so I did not built an universal framework, just release version... I would genuinely like to solve this issue, because it has been a nightmare for me..

Viktor Vostrikov
  • 1,322
  • 3
  • 19
  • 36
  • Possible duplicate of: https://stackoverflow.com/questions/53649761/framework-was-built-without-full-bitcode-framework-bitcode-already-enabled?noredirect=1&lq=1 The suggested answer there was: "Try to set Skip Install to YES and Embed Bitcode to YES in framework build settings." Does that help you? – emmics Jan 07 '19 at 23:12
  • 3
    @Muli no, I have commented on that question.. and it did not solved it... still trying, but feel kinda hopeless.. – Viktor Vostrikov Jan 07 '19 at 23:19
  • @ViktorVostrikov, have you found a solution to this? I am facing a similar issue – Derryl Thomas Aug 26 '19 at 12:23
  • Anecdotally: I needed `OTHER_CFLAGS = "-fembed-bitcode";`, `OTHER_LDFLAGS = "-ObjC";`, and `BITCODE_GENERATION_MODE = bitcode;` for getting a static Swift framework with an Obj-C bridge to work when Archiving a bitcode-enabled app that consumed it. – MechEthan Dec 10 '19 at 20:15

2 Answers2

9

If you're using pods, try adding this to the Podfile (it resolved the same issue for me):

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
            config.build_settings['ENABLE_BITCODE'] = 'YES'
        end
    end
end
Simon
  • 1,657
  • 11
  • 16
1

Details

  • Xcode Version 11.3.1 (11C504)

Solution

Add the following code at the end of the podfile

def enable_bitcode_in(config)
  cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
  if config.name == 'Release'
    cflags << '-fembed-bitcode'
    config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
  else # 'Debug'
    cflags << '-fembed-bitcode-marker'
    config.build_settings['BITCODE_GENERATION_MODE'] = 'marker'
  end
  config.build_settings['OTHER_CFLAGS'] = cflags
end

def enable_bitcode_for(targets)
  targets.each do |target|
    target.build_configurations.each do |config|
      enable_bitcode_in(config)
    end
  end
end

post_install do |installer|
  enable_bitcode_for(installer.pods_project.targets)
end
Vasily Bodnarchuk
  • 24,482
  • 9
  • 132
  • 127