ERROR "swiftc failed with exit code 1" when converting to latest syntax
I was trying to convert syntax of old Swift project to new one as per few suggestion on Stack Overflow I tried converting it through Edit > Convert > To latest Syntax that did not work properly instead I started getting new errors shown as below
Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
And
Command /usr/bin/ditto failed with exit code 1
I tried Xcode 6.0.1 Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1, but it's a different situation.
Solution 1:
Have you tried to do clean with Clean build folder?
The combination keys is:
ALT + SHIFT + COMMAND + K
Solution 2:
Try delete Derived Data folder and Build it.
Go to Xcode -> Preferences -> Locations for get the derived data path
Solution 3:
Just had the same issue. For me it was because I had renamed some of the project directories. I had a ton of red files in my project navigator. To solve, follow these steps:
- click on the directory in project navigator where many files show as red
- Under "Identity and Type" in the File Inspector (on the right side), click Containing directory
- Select the new directories
- Rebuild - command shift K, command B
Solution 4:
- Clean Xcode. (cmd+shift+k)
- Quit Xcode completely.
- Open project again.
- Wait for Xcode to indexing files.
- Now run your project.
Solution 5:
As far as I know there can be multiple reasons why a compiler fails. Although cmd+alt+shift+k will help most of the time. If this fails, then click on the error message and try to debug it.
For example in the image below, if you read the message, we get to know that, there has been a name duplication. Fixing the name duplication will fix the issue.