Problems after upgrading to Xcode 10: Build input file cannot be found

前端 未结 28 1962

I upgraded my Xcode SDK to version 10 last night and then find I cannot build.

I\'m getting this error:

Build input file cannot be found: \

相关标签:
28条回答
  • 2020-11-28 04:48

    I had a similar issue after upgrading to a new swift version recently. Moving files around caused my xcode project to reference items that were no longer in the project directory giving me the Error Code Build Input File Not Found.

    In my situation I somehow had multiple files/images that were being referenced as described below:

    In the image above.

    • Navigate to your Targets page.
    • Then Click on the Build Phases tab on the top.
    • Scroll Down to Copy Bundle Resources
    • Find the affected files and remove them. (hit delete on them or select them and hit the minus button )

    It was in here that I somehow had multiple files and images that were being referenced from other folders and the build would fail as they could no longer find them. And I could not find them either! or how Xcode was still referencing them

    I hope this helps someone else !

    0 讨论(0)
  • 2020-11-28 04:49

    This worked for me in Xcode 10:

    • Click Project icon/name in your Xcode project
    • Go to General tab
    • Click [Choose info.plist File] under Identity section
    • Select the info.Plist file
    • Check Info tab to see if info.plist was loaded successfully
    • Build and run
    0 讨论(0)
  • 2020-11-28 04:49

    I ran into this problem soon after upgrading to Xcode 10, but that was not the issue.

    I tried changing the build system, but that gave me a separate error that meant the same thing. Generally saying "File X can not be found".

    There are multiple things to check when a file can not be found.

    1. Recovered references Folder Apple does this nice thing where if it detects a reference to a file that doesn't exists it will add this reference into a group called "Recovered References"

    That is nice of Apple but it doesn't always work.

    1. Build Phases Compile Sources In this list, there could be meta data for a file that the project is suppose to compile, but the file does not actually exists and it's attempting to find the file at the given path. In this list it will be dimmed out, delete them and re-add them by toggling the file's target dependencies or manually removing it and dragging it in.

    2. File's Path Double check the file path that the error is printing out and the file path for the file in finder. You can easily see this by clicking on the file in Xcode and checking the "Show the file inspector" tab (the left most tab). If these paths are correct then you are good!

    3. Dimmed out files in your project that are not in recovered references or red This one pissed me off because it's not obvious about what happened, but basically if you go into finder and move a file to a different location with out updating the reference in the project it will throw the error as the file no longer exists there. The only indication I have found for that is that the file in the "Project Navigator" tab (left most tab) is very slightly dimmed, but when you go to delete this file Xcode doesn't prompt you to delete the reference or send to trash. You can fix this by deleting the file and re-adding it to the project or going to the "File Inspector" tab and click the folder icon next to the path and change it to the proper location.

    Either way, the error indicates that it can't find a file, switching to the old build system is a bandaid for a more concrete issue. We as developers understand that a compiler just wants an artifact to be listed at the end of a file path. Somewhere the path is not correct! We have to find where that is!

    My issue was resolved with item 4 listed above. Hope this helps somebody.

    0 讨论(0)
  • 2020-11-28 04:51

    Try to switch back to the Legacy Build System (File > Project Settings > Workspace Settings > Legacy Build System)

    0 讨论(0)
  • 2020-11-28 04:52

    I had the same issue. The problem was that I didn't have any file under the Target > Build Phases > Compile Sources. The problem was solved after I added at leas one file to Compile Sources.

    0 讨论(0)
  • 2020-11-28 04:53

    In my case, I had created a new test target and deleted the default swift file so it was left with just the info.plist. Adding a new file fixed this.

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