Xcode- 7: No such file or directory

2019-01-25 10:14发布

问题:

I keep trying to run my Xcode project (titled "YidKit") and it keeps giving me the following error: error: /Users/Dani/Library/Developer/Xcode/DerivedData/YidKit-exnbjyxkgkbeaedoznkmtoenfijq/Build/Products/Debug-iphoneos/YidKitTests.xctest: No such file or directory. I spent several hours online, trying different solutions that I've seen, and nothing has worked. This is driving me crazy, because it is the only error left and I just finished getting rid of about 80 that were caused by Swift 2.0. I appreciate all of the help I can get!

UPDATE Here is an image of the file in the explorer. The red one is the file that is giving me the error.

回答1:

do following two things I might solve your problem.

  1. Product -> Clean and build folder
  2. Go to finder -> library -> Developer -> Xcode -> Derived data delete that folder

or check screen shot may be this is your problem

and then check



回答2:

TARGETS --> Build Phases --> search file --> delete redundant .m



回答3:

For future reference

One way you can solve this problem is to open your Project with a text editor and search for the file there. It should be there the file path for it. Just delete it and any references that might exist of the file.

It should be working now.

Don't forget to BACKUP FIRST before doing this



回答4:

Go to project, target, build phase

  1. remove the files causing problem (click - below)
  2. add the files again (File -> Add Files to Project)
  3. clean then run


回答5:

You should try to edit option in folder to show more you looking then you will see some error file inside after you find it delete it! Hope this help.



回答6:

I'm sure you've figured out a workaround by now but for those still running into this problem the error is occurring because Xcode is trying to access a file for your project, but it can no longer find it. In your case the file it can't find is YidKitTests.xctest, so what you can do is click on it in the Project Navigator, then on the right in the File Inspector, click on the little folder icon under Location. When you click on the folder a Finder window will open up and its your job to navigate to where the YidKitTests.xctest file should be and double click on it. More often than not the file is in the exact place Xcode says it isn't, eg. /Users/Dani/Library/Developer/Xcode/DerivedData/YidKit-exnbjyxkgkbeaedoznkmtoenfijq/Build/Products/Debug-iphoneos/YidKitTests.xctest, but for some reason it can't see it without you pointing it out. I hope this helps!



回答7:

I had a similar error popping up, and it turned out being the simulator was not being found. So, I deleted all my simulators and and added new ones. This fixed it for me. It's pretty unlikely this will be a fix for you, but I really wish I had seen this response 3 hours ago.



回答8:

The solution which worked with me is as following:

  1. Go in the left panel of the Xcode to products folder then select the Tests.xctest file

  2. In the right panel of Xcode / Target Membership, unselect Tests

  3. Click command u



回答9:

Just delete the "Derived Data" folder and compile the project again.



回答10:

Anyone tried the good old trick rebooting the computer? I tried and everything worked out fine! Give it a try



标签: ios xcode xcode7