How to fix "Build input file cannot be found" error in Xcode
source link: https://sarunw.com/posts/how-to-fix-build-input-file-cannot-be-found/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to fix "Build input file cannot be found" error in Xcode
Build input file cannot be found: '/path/to/some/of/your/file1', '/path/to/some/of/your/file2', ....
There might be several reasons that cause this error. I will share one solution that fixes the one that happened to me the most.
Cause of the problem #
For me, I got this error when I try to solve merge conflict that happen on project.pbxproj
. When there is changes in project structure I have to figure out conflict that look like this:
A000701D256E5ADF009F48A4 /* UsageDetailViewModelTests.swift in Sources */,
17E973942505E3EA0084D10D /* MainTabBarViewModelTests.swift in Sources */,
174BF411251C9C1E00FE6214 /* CommonNotificationIconViewTests.swift in Sources */,
=====
NOT_A000701D256E5ADF009F48A4 /* UsageDetailViewModelTests.swift in Sources */,
NOT_17E973942505E3EA0084D10D /* MainTabBarViewModelTests.swift in Sources */,
NOT_174BF411251C9C1E00FE6214 /* CommonNotificationIconViewTests.swift in Sources */,
There might be a better way to resolve this, but I always solve it quick and dirty by accepting one of them, or sometimes I take both of them. Manual manipulates of project structure like this can cause corrupted project structure, which is the cause of the error we will solve today.
"Build input file cannot be found" errorLearn everything you need to know about Sign in with Apple to be able to integrate it in your existing app or a new one.
Solution #
- Open "Project Navigator" (Menu View > Navigators > Project ⌘ - command + 1).
- You will see a group name "Recovered References" that Xcode generated for you. If you have a large project, you can filter it out by type "Recovered References" at the very bottom of the project navigator.
- Inside the group, you should see a list of files mentioned in the "Build input file cannot be found" error.
- Next step might vary based on your situation. Normally, you will need to delete all red color files, which dictate that Xcode can't find their reference in the destination paths.
- You need to add them back so Xcode knows where it should look for those files.
Recovered References was added in Xcode 9
When a project is opened, Xcode may create a Recovered References group in the Project navigator. This group contains files that are referenced in a target but aren't referenced in the group tree of the project. If the group appears, move each file to the proper location in the project as appropriate. (22924751)
– Release Notes for Xcode 9
Related Resources #
Feel free to follow me on Twitter and ask your questions related to this post. Thanks for reading and see you next time.
If you enjoy my writing, please check out my Patreon https://www.patreon.com/sarunw and become my supporter. Sharing the article is also greatly appreciated.
How expensive is DateFormatter
If you are working on iOS for long enough, there is a chance that you might have known that DateFormatter is expensive, but what is costly about DateFormatter? Let's find out in this article.
Testing is a process we do along with our development. Knowing shortcuts would help you save some time, which will add up in the long run.
XcodeGet new posts weekly
If you enjoy this article, you can subscribe to the weekly newsletter.
Every Friday, you’ll get a quick recap of all articles and tips posted on this site — entirely for free.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK