ERROR “swiftc failed with exit code 1” when converting to latest syntax

前端 未结 26 2089
傲寒
傲寒 2020-12-14 05:31

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 Synta

相关标签:
26条回答
  • 2020-12-14 06:00

    Cleaning the project wasn't working for me, this is because I didn't pay attention to the message right above (Xcode highlights only the final command).

    In my case it was

    <unknown>:0: error: filename "FileDuplicated.swift" used twice: '/../filepath/FileDuplicated.swift' and '/../filepath/FileDuplicated.swift'
    <unknown>:0: note: filenames are used to distinguish private declarations with the same name
    Command /../bin/swiftc failed with exit code 1
    

    I had to change the name of one of the two files and it was solved.

    Hope this can help someone, cheers

    0 讨论(0)
  • 2020-12-14 06:02

    delete Derived Data folder and Build it.

    Go to Xcode -> Preferences -> Locations for get the derived data path or cmd+Alt+shift+k

    OR

    Just remove inactive file(deleted file) from Build phases

    0 讨论(0)
  • 2020-12-14 06:02

    Ok, my turn now. In my case I had an existing project. I copied in a few files from another project. One of the files I brought in was SettingsViewController.swift and there was already a file by the same name I was not aware of. The files were in different directories of the project so no duplicate message was shown. The compile/link messages offered no clue to this. I figured out the issue by adding one file at a time to the project (there were 12 total) and the building each time until I found the offending file. I renamed the new file and project builds now.

    0 讨论(0)
  • 2020-12-14 06:04

    In my case it was due to the few swift files which has been showed grayed out in the Build Phases section. After removing those files it was successful.

    0 讨论(0)
  • 2020-12-14 06:04
    1. Clean the build in Xcode cmd+shift+k.
    2. Update the pods.
    3. look the where errors showing.
    4. Add the missing files in Xcode.
    5. After Run the Code. Working fine.
    0 讨论(0)
  • 2020-12-14 06:05

    Have you tried to do clean with Clean build folder?

    The combination keys is:

    ALT + SHIFT + COMMAND + K

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