我使用的是Xcode10.2,Swift 5。
对于调试方案,没有发生问题,但是对于发布方案,当我构建或存档时,它显示命令compileSwift失败,并显示非零退出代码。
我已经尝试删除DerivedData / Clean / pod deintegrate & pod install & pod update。这些都不起作用。


发布于 2019-03-29 19:43:57
对于我的项目,问题与pod Cache有关,当Release的Optimization Level设置为Optimize for Speed [-O]时,它会给出错误。我再次将Compilation Mode设置为Whole Module,并在pod文件中为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参考:https://github.com/hyperoslo/Cache/issues/233#issuecomment-477749560
发布于 2019-03-26 23:44:40
我修复了这个问题,进入Pods项目,然后进入构建设置,并将编译模式设置为Incremental Release。然后清理和归档,应该可以编译好了。
发布于 2019-03-26 18:22:48
因此,当我将我的项目更新到Swift 5时也遇到了同样的问题。出于某种原因,Cocoapods (最新版本,1.6.1)将一些pods的SWIFT_VERSION设置为Swift 5,即使它们发布为Swift 4,4.1,4.2 pods。因此,我不得不添加一个安装后脚本,如下所示设置swift的校正版本
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'CryptoSwift' || target.name == 'SwiftyBeaver'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end
endhttps://stackoverflow.com/questions/55351736
复制相似问题