Files in Xcode not working (names in red)

2020-07-24 05:03发布

问题:

I renamed my app folder to try and change the name of the app because it didn't work in the project navigator and when I did so, all files came up in red. I have tried to fix it by renaming the files back to how they were but it still doesn't work.

Any help would be greatly appreciated.

Link to dropbox: https://www.dropbox.com/s/omvo0saff0z9ncc/TicketekApp%202.zip?dl=0

回答1:

If files marked in red, they are "not found" by Xcode.

You either moved or deleted them within File Finder, outside Xcode. Delete the red marked files within XCode, then add them again to XCode.

This will solve your problem.



回答2:

I solved this problem as follows: click on the Group name in which file names are showing in red colour in the Xcode navigation area (Navigator) on the left side. In the Utility area on the right side in Xcode open up File Inspector tab. There is a Field named Full Path:, click on the arrow placed last to the path. You will have popup window showing your project path. Change The Group Folder in which you already moved your files from Finder.



回答3:

In my case after moving the projects to a new folder and fixing each file location, the project compiles properly but the files names were still in red.

The problem was that the files were grouped in groups. The group was the cause of the red names of the files. So I added new groups, with identical names to the old ones (Xcode allows to do it since it does not know were is the old group), moved the files from each group to it's new group and deleted the old groups.

Now all the red names are gone.



标签: ios xcode7