Xcode 10.2 编译失败,如何对敌?

Xcode 10.2 Build failed:Command CompileSwiftSources failed with a nonzero exit code

Xcode 10.2

今天早上,苹果推出了 Xcode 10.2 更新。如果你更新了,可能会遭遇一个未分类的 error:

Command CompileSwiftSources failed with a nonzero exit code

完全不知道编译失败的原因。

实际上苹果已经在 Release Note 里说过这事了:

Compilation might fail without displaying the errors responsible for the failure. For example, you might see the message “Command CompileSwiftSources failed with a nonzero exit code” without an accompanying failure reason. (43033749) Workaround: Disable batch mode by adding a user-defined build setting named SWIFT_ENABLE_BATCH_MODE and set it to NO.

具体操作

打开你的 Target 的 Build Settings:

image

Build Settings

点击加号,添加一个 User-Defined Setting:

image

添加 User-Defined Setting

命名为 SWIFT_ENABLE_BATCH_MODE,设置为 NO:

image

设置 SWIFT_ENABLE_BATCH_MODE

设置完,再编译就能显示确切的 Error 位置。

本文转载自:https://zhuanlan.zhihu.com/p/60453657
如有侵权,请联系我删除文章

你可能感兴趣的:(Xcode 10.2 编译失败,如何对敌?)