错误描述:
module name "Swift" is reserved for the standard library
Command CompileSwiftSources failed with a nonzero exit code
第一句
module name "Swift" is reserved for the standard library
的意思是Swift
是保留在标准库里面的组件名字,所以呢我们不能把它作为工程的名字,我们换一个工程名字就不会报错了。第二句
Command CompileSwiftSources failed with a nonzero exit code
意思就是编译失败。Apple对这句话做了解释:
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 namedSWIFT_ENABLE_BATCH_MODE
and set it toNO
.
意思就是编译失败时,可能会出现这种提示Command CompileSwiftSources failed with a nonzero exit code
,但是并没有明确指出失败的原因,此时可以通过在Build Setting里面自添加一条user-defined(备注:点击Levels边上的 + 号就可以添加),属性为SWIFT_ENABLE_BATCH_MODE
,值为NO
。再次编译就会提示编译失败的真正原因。文档链接:Swift 4.2 Release Notes for Xcode 10
综上,文章开头截图里面的错误意思就是编译失败,原因是使用了标准库中组件名Swift
作为了工程名。
网友评论