Compiled framework provides bitcode error when archiving

前端 未结 2 1216
死守一世寂寞
死守一世寂寞 2020-12-19 03:15

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

相关标签:
2条回答
  • 2020-12-19 03:37

    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
    
    0 讨论(0)
  • 2020-12-19 03:46

    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
    
    0 讨论(0)
提交回复
热议问题