10

After updating from Xcode 8.1 to 8.2, I am facing a Swift Compiler Error in my project. I am using the latest Swift version and Carthage for dependency management. It worked perfectly fine with Xcode 8.1, and now I have tried for hours to fix it by cleaning DerivedData and Simulator data, cleaning in Xcode and deleting the Build folder but nothing seems to help. I only have one Xcode version installed.

I get the following compile error:

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 

The folder that it is referring to looks like this:

folder that cannot be found

It is actually there so I have no clue about what is going on... Help is much appreciated! :)

4
  • Does it build OK if you set the device to Generic iOS Device? Commented Dec 16, 2016 at 14:16
  • No, it is the same Commented Dec 16, 2016 at 14:34
  • 1
    I had the same issue which for me was caused by messing up the swift flags. I think it must have been introduced when I removed cocopods, leaving a -D. Commented Dec 19, 2016 at 10:21
  • 3
    Yes, you are absolutely right! I have made the switch to Carthage after using CocoaPods, and when cleaning up my project for Xcode 8.2, I deleted the "COCOAPODS" flag from the "Other Swift Flags". I just tried to add it again and it compiles perfectly! But it doesn't really make any sense that it needs that flag after ditching CocoaPods. Do you know how to get rid of it? Commented Dec 19, 2016 at 11:14

2 Answers 2

13

I had the same kind of issue and the comments helped me figure out my problem.

Indeed, this error occurs when there is a typo or an error with the "Other Swift Flag" option. In my case, this option was passed empty by my CI engine causing an error to the generated command line leading to the error :

"error: unexpected input file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk"

As suggested in the comment, remove all Other Swift Tag except "$(inherited)" and check it works back as expected

Answering the question instead of commenting may help people straight forward :)

Sign up to request clarification or add additional context in comments.

1 Comment

I removed all "Other Swift Flags" except "$(inherited)". Finally it worked well
4

In my case it was simply because I had a file called .Swift (mind the capital S!). I renamed it correctly to .swift and all went fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.