Critical problems with creating groups in Xcode

I’m halfway through Chapter 27 of iOS Apprentice, and everything was proceeding smoothly until I decided to clean up the project navigator by grouping the files.
I put all my view controllers into one group, all my core data files into one group, and the storyboards as well as all other files into another called ‘resources’. AT that point, everything was working fine
The next time when I launched Xcode and tried to build the app, however, I saw that info.plist was written in red in the project navigator and the app refused to compile. I checked the app’s finder folder, and everything seemed all right - info.plist was within the resources folder, but the app was returning error messages of it being unable to find the file where I had just seen it.
I tried to remove all other files from that folder outside of it and removed the folder altogether, but then more similar error messages appeared for all other files that were previously in that folder, except for the two storyboard files. I tried removing all files from their groups, and no new errors have come, but the old ones persist -

I’ve tried moving the files back and forth and tried quitting and relaunching Xcode, launching the project from Finder itself, cleaning the build folder, but there’s been no change.
I could use the book resources, but I’ve written a ton of useful comments for my own reference in all of the files. It’s not completely ruled out, though; but is there any way of fixing this issue? Has anybody else faced this same problem?
Many thanks.

Do note that the resources group you see in the navigator is empty. this is an older screenshot I attached by accident. I have since deleted it but the errors persist

When Xcode shows a file in red in the Project navigator, that means that that file is not where Xcode thinks the file should be. It is possible that the file is in the correct place where you think it should be, but Xcode might not be looking in that place :slight_smile:

If you highlight a file which is in red and then open the File inspector on the right sidebar (you should be able to find it via the View menu) you will see where Xcode expects the file to be. If that’s not the place where you have the file, then delete the file in red in Xcode (not in Finder) and then add the file back from the correct location.

You might need to do this for a lot of files since you moved things around a lot. But once you fix everything, if you moved the PLIST file, you’ll still get a compiler error since Xcode has at least one project setting where the PLIST file location is explicitly saved. You’d need to go into Build Settings for your project, find the location and modify that too. Then (hopefully) everything will compile.

It works! All the old errors have gone, and the files are no longer appearing in red text.
Thanks a ton for the help!

This topic was automatically closed after 166 days. New replies are no longer allowed.