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

前端 未结 26 2022
傲寒
傲寒 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:10

    I just had this issue. It's due to path references. Have you been moving files around and/or copying folders? Check if .xcodeproj is inside or outside of the main project folder. Also, make sure that the project's file and directory structure are intact.

    /yourFolderProjectName/ <-- contains your .xcodeproj file AND folder with Xcode project name

    /yourProjectFolder <-- here are .swift, info.plist, assets folder, etc.

    /yourProjectXcodeFile.xcodeproj

    0 讨论(0)
  • 2020-12-14 06:12
    1. Clean Xcode. (cmd+shift+k)
    2. Quit Xcode completely.
    3. Open project again.
    4. Wait for Xcode to indexing files.
    5. Now run your project.
    0 讨论(0)
  • 2020-12-14 06:12

    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.

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

    In my case, it was "Other swift flags". I had declared a flag there but not -D, so this was not getting recognized and resulted in the same error

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

    Wait for completing the indexing and run the project again. You must get an error then check it which may be Objective-c bridging file not found error. This error comes if you are using any Objective-C library or code directly in the project and your project unable to find the bridging file in the system. This issue basically caused by, if project is unable to find any file in the system which is using in the project (path issue).

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

    Try delete Derived Data folder and Build it.

    Go to Xcode -> Preferences -> Locations for get the derived data path

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