Xcode 8.2,Swift编译器错误:错误:意外的输入文件

And*_*iis 8 xcode xcodebuild swift

从Xcode 8.1更新到8.2后,我在项目中面临Swift编译器错误.我使用最新的Swift版本和Carthage进行依赖管理.它与Xcode 8.1完美搭配,现在我已经尝试了几个小时来修复它,通过清理DerivedData和模拟器数据,清理Xcode并删除Build文件夹,但似乎没有任何帮助.我只安装了一个Xcode版本.

我得到以下编译错误:

CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
cd <ProjectSource>
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk
export TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault

-- all files to compile --

unknown>:0: error: unexpected input file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 
Run Code Online (Sandbox Code Playgroud)

它所指的文件夹如下所示:

无法找到的文件夹

它实际上在那里,所以我不知道发生了什么......非常感谢帮助!:)

r4p*_*phG 10

我有同样的问题,评论帮助我弄清楚我的问题.

实际上,当"其他Swift Flag"选项出现拼写错误或错误时会发生此错误.在我的情况下,我的CI引擎将此选项传递为空,导致生成的命令行出错,从而导致错误:

"error: unexpected input file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk"
Run Code Online (Sandbox Code Playgroud)

回答问题而不是评论可能会帮助人们直接:)

  • 我删除了除"$(inherited)"之外的所有"其他Swift标志".最后它运作良好 (4认同)