Xcode – How to change the location of files in xcode project

xcode

I put some files on the same level of *.xcodeproj file carelessly. When I move these files into the right location in Finder, Xcode tells me that these files are missing. So I delete the group which contains these files whose names have been read (I realize it is a mistake). And I drag these files from Finder into the xcode to build a new group. But when I try to run the project, Xcode still can't find these code. How can I solve the problem?

Best Answer

When you see a file that is red (or in the wrong place), you can easily correct the location of these files by using the file inspector (which appears along the right side panel of your Xcode window).

It looks like this:

Use File Inspector to fix path

Clicking on the Folder icon next to the name will bring up an open panel from which you can choose the correct location of the file.