本文介绍了Xcode 10.2,Swift 5,命令compileSwift在使用Release Scheme生成程序时失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Xcode 10.2,Swift 5。

I'm using Xcode 10.2, Swift 5.

使用Debug方案,不会发生任何问题,但是在构建或归档时使用Release方案,它显示Command compileSwift失败,退出代码非零。

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

我尝试删除DerivedData / Clean / pod deintegrate&吊舱安装和安装广告连播更新。这些都不起作用。

I've tried delete DerivedData / Clean / pod deintegrate & pod install & pod update. None of these works.


推荐答案

对于我的项目,问题与pod Cache 有关,当<$ c针对$code>发布的$ c> Optimization Level 设置为针对速度[-O] 的优化。我再次将编译模式设置为 Whole Module 并在pod文件中设置pod的优化级别:

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

引用:

这篇关于Xcode 10.2,Swift 5,命令compileSwift在使用Release Scheme生成程序时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 15:30