xcode 命令 ...swiftc 失败,退出代码为 1
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26642216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Command ...swiftc failed with exit code 1
提问by user26830
I am stuck with this error for a while, and none of the solutions I've found seems to work (at least, in my case). Here is the full error log:
我被这个错误困住了一段时间,我发现的所有解决方案似乎都不起作用(至少,就我而言)。这是完整的错误日志:
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
cd "/Users/user/Documents/Music Kit A"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -target x86_64-apple-macosx10.10 -module-name Music_Kit_A -Onone -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -g -module-cache-path /Users/user/Library/Developer/Xcode/DerivedData/ModuleCache -I /Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Products/Debug -F /Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Products/Debug -c -j4 /Users/user/Documents/Music\ Kit\ A/Music\ Kit\ A/AppDelegate.swift /Users/user/Documents/Music\ Kit\ A/Music\ Kit\ A/main.swift -output-file-map /Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/Objects-normal/x86_64/Music\ Kit\ A-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/Objects-normal/x86_64/Music_Kit_A.swiftmodule -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/Music\ Kit\ A-generated-files.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/Music\ Kit\ A-own-target-headers.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/Music\ Kit\ A-all-target-headers.hmap -Xcc -iquote -Xcc /Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/Music\ Kit\ A-project-headers.hmap -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Products/Debug/include -Xcc -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/DerivedSources/x86_64 -Xcc -I/Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/DerivedSources -Xcc -DDEBUG=1 -emit-objc-header -emit-objc-header-path /Users/user/Library/Developer/Xcode/DerivedData/Music_Kit_A-cimwnaollginmxefzprqiioyrhfl/Build/Intermediates/Music\ Kit\ A.build/Debug/Music\ Kit\ A.build/Objects-normal/x86_64/Music_Kit_A-Swift.h
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
What I've tried:
我试过的:
Clean the project
Comment my last changes
Create a new project and transfer the code
清理项目
评论我最近的更改
创建一个新项目并传输代码
When I create a new project, this error goes away, but get another one saying that there is an implicit entry point to main
. Searched the whole project for a main function, but nothing showed up. My whole code is here, if it's of any use.
当我创建一个新项目时,这个错误消失了,但另一个人说有一个隐式入口点到main
. 在整个项目中搜索了一个主要功能,但什么也没出现。我的整个代码都在这里,如果它有任何用处。
回答by tony508
Try to use xcodebuild -project ***.xcodeproj -scheme ***
, it will give you more details about the error.
尝试使用xcodebuild -project ***.xcodeproj -scheme ***
,它将为您提供有关错误的更多详细信息。
For me was adding [unowned self]
to a block inside a block.
对我来说是添加[unowned self]
到块内的块中。
回答by Amin Benarieb
In my case this code causes the error:
在我的情况下,此代码导致错误:
processBtn.setTitleColor(.whiteColor(), forState: .Normal)
But if i add UIColor everything goes fine:
但如果我添加 UIColor 一切正常:
processBtn.setTitleColor(UIColor.whiteColor(), forState: .Normal)
Maybe you have similar errors in you code.
也许您的代码中有类似的错误。
回答by Bryan P
For other people who are having this problem now. Please revert your previously deleted files in the system.
对于现在遇到此问题的其他人。请恢复您之前在系统中删除的文件。
Your project might still be referencing that file somewhere in your project.
您的项目可能仍在项目中的某处引用该文件。