Xcode 10.2,Swift 5,命令compileSwift在使用Release Scheme生成程序时失败

Ran*_* Bi 18 xcode ios cocoapods swift

我正在使用Xcode 10.2,Swift 5。

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

我试过删除DerivedData / Clean / Pod解集成&Pod安装&Pod更新。这些都不起作用。

在此处输入图片说明 在此处输入图片说明

Olc*_*taş 7

对于我的项目,问题与pod有关,CacheOptimization Levelfor Release设置为时,pod 会给出错误Optimize for Speed [-O]。我已Compilation ModeWhole Module了在POD文件荚一次集优化级别:

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
Run Code Online (Sandbox Code Playgroud)

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


Nei*_*ner 6

我通过将Pods Project转到建筑设置并将Compilation Mode设置为Incremental for Release来解决此问题。然后清理并存档,然后应编译良好。


小智 0

你可以按照这个步骤...

  1. 确保将 Swift 版本更改为您当前的版本。
  2. 更新所有 pod。
  3. 清理 Xcode 的所有派生数据。
  4. 现在重新启动您的 Mac。

您收到所有这些错误只是因为 pod。所以您需要更新您正在使用的每个 pod。