Xcode 6.0.1 Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1

后端 未结 24 2328
长情又很酷
长情又很酷 2020-11-27 13:18

I am getting this error on archive:

Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with

相关标签:
24条回答
  • 2020-11-27 13:55

    I had a resolution very similar to RyanM, where with an excess of hubris I tried to assign a variable to the default value of an inner function:

    Fails to compile (though does not crash SourceKit):

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        func itemCell(_ indexPath: IndexPath = indexPath) -> UITableViewCell {//...}
    

    Succeeds:

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        func itemCell(_ indexPath: IndexPath) -> UITableViewCell {//...}
    
    0 讨论(0)
  • 2020-11-27 13:57

    So, I had the above and narrowed it down to a TFS issue with locking the file but only when I pasted or did any other edits besides small copies or manual typing. I noticed the original file would compile, but my edits wouldn't, even though they were syntactic OK. Also related is unable to save document: xcode The document "..." could not be saved

    The fix for both was:

    1. Duplicate working version.
    2. Paste fully-merged new code into duplicate.
    3. Copy and paste old file over new one. (I personally just renamed the old one to something else, then pasted duplicate and renamed it, too. Guessing both work since I pasted directly earlier for reverts during tests to see).

    Voila. Lazy way to bypass merge-locking issue. Apparently full file-pastes are just fine, while edits aren't. Shared since the other answers don't seem to be as lazy as this. ;) Note: I am suspecting a non-UTF-8 character made its way somewhere, but pastes worked in older versions so I don't know where, or if relevant.

    0 讨论(0)
  • 2020-11-27 13:58

    Just go to the "project setting" and click on the "build phaces" after that you will find targets in that u have to delete the test file like my project name "WER" so its showing like this WER&TEST so just delete that and clean ur project and run .........

    0 讨论(0)
  • 2020-11-27 13:59

    This error occurred for me after I noticed that a few of my .swift files were inexplicably in the wrong directory -- one level above my Xcode project directory. When I noticed this, I moved them into the main project directory and cleaned the project, thinking everything would be fine. However, upon building the project I got the above-mentioned "failed with exit code 1" error. Just above the error message it listed the files I had just moved, indicating that it couldn't find them in the directory where they used to be. In addition to the error message, the files I moved were now showing up as red in the file navigation pane.

    For each of the files in question what I did to resolve this was: - Select the file from the list of files in the Xcode file navigation pane, - Click on the little page icon in the rightmost pane of Xcode, which opens a file attributes pane, - Click on the little folder icon underneath where it says "Location" in the file attributes pane, - Choose the new location for the file, - RESTART Xcode for the above changes to really do anything.

    0 讨论(0)
  • 2020-11-27 13:59

    In my case, the error was the result of missing files that were generated by Xcode. I tried the regular clean Opt+Shift+K and it didn't clean up all the errors. I found a post on the Apple Developer site that recomended going to the Product Menu in Xcode, holding down the opt key, and selecting Clean Build Folder. This appears to be a more comprehensive build as it pops up a modal dialog for you to confirm.

    0 讨论(0)
  • 2020-11-27 14:02

    This problem occurs when the Swift optimization level is not set to None for Release. Set the value to None and the issue goes away.

    1. Open up your project and click on the projects root directory.
    2. Click the build settings tab.
    3. Search for Swift Compiler - Code Generation and under Optimization Level make sure Release is set to None.

    EDIT

    After upgrading to Xcode 6.1 these instructions caused other issues when archiving (building for debug/device worked fine). Setting the optimization to Fastest allowed me to archive again. There are apparent issues with Swift compiling still (archiving specifically).

    Can't archive working 6.0.1 Swift project in Xcode 6.1 / Segmentation fault: 11

    EDIT I was not able to fund the Build Settings tab, until I read this answer.

    how to find the build settings tab

    0 讨论(0)
提交回复
热议问题