Xcode 10.2, Swift 5, Command compileSwift failed while build the program with Release Scheme

前端 未结 7 1399
我寻月下人不归
我寻月下人不归 2021-01-03 22:38

I\'m using Xcode 10.2, Swift 5.

With Debug scheme, no issue happens, but with Release scheme when I build or archive, it shows Command compileSwift failed with a non

7条回答
  •  醉酒成梦
    2021-01-03 23:12

    For my project problem was related to pod Cache which gives error when Optimization Level for Release is set to Optimize for Speed [-O]. I have set Compilation Mode to Whole Module again and set optimization level for the pod in pod file:

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        # Cache pod does not accept optimization level '-O', causing Bus 10 error. Use '-Osize' or '-Onone'
        if target.name == 'Cache'
          target.build_configurations.each do |config|
            level = '-Osize'
            config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = level
            puts "Set #{target.name} #{config.name} to Optimization Level #{level}"
          end
        end
      end
    end
    

    Refrence: https://github.com/hyperoslo/Cache/issues/233#issuecomment-477749560

提交回复
热议问题