'Build input file cannot be found' Swift 4.2, Xcode 10.0

前端 未结 26 2142
忘掉有多难
忘掉有多难 2021-01-30 10:16

I am getting the following error when building in Xcode 10.0 with swift 4.2:

相关标签:
26条回答
  • 2021-01-30 10:35

    I tried going to Compile Sources in the Build Phases tab and deleting and re-adding the selected file (and cleaning and rebuilding)but it didn't work :( Instead, this following answer worked for me if you get the 'Build input file cannot be found' error message:

    1. Delete the affected files in Xcode (I right-clicked->Delete'd in the Navigator)
    2. Re-add the affected file (mine was .mlmodel) and I selected "Copy items if needed" under Destination.
    3. Cmd-shift-k to clean and then Cmd-b to build and voila! The file was recognized and error gone!

    Hope this helps!

    0 讨论(0)
  • 2021-01-30 10:35

    For me something totally different worked:

    Go to Target>Build Settings>Architectures

    My valid architectures before: arm64 arm64e armv7 armv7s (Defaults)

    Changed it to: armv7 i386 arm64 armv7s

    0 讨论(0)
  • 2021-01-30 10:35

    If all else fails:

    1. In Xcode. Remove references of files in question from your project.
    2. Open your project.pbxproj file as a file in Xcode. This is in .xcodeproj
    3. Delete all lines containing the name of said files. Save.
    4. Back in Xcode. Re-add files to your project in Xcode.
    0 讨论(0)
  • 2021-01-30 10:35

    Had the same problem with swift files. Select files that are not recognised and Delete with Remove Reference option. Right click in the folder and Add files again.

    0 讨论(0)
  • 2021-01-30 10:35

    I got this error when i renamed a ViewController name using "Refactor". The view controller name occurrences were changed but an old reference was somewhere still existing.

    Deleting derived data & Clean build folder worked for me.

    Here's how to delete Derived data:

    File>Workspace settings> Click arrow & remove all folders inside Derived Data.

    0 讨论(0)
  • 2021-01-30 10:36

    A most common error when you move Info.plist in another folder. To fix this error you can select the Info.plist and choose Relevant to Project from file inspector.

    Next step, go to Build settings and search for info.plist and fix the file path.

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