Reputation: 8066
When I move iphone project directory to a new path. There are some red texts indicate the missing files from the project source codes. How to avoid these?
Upvotes: 34
Views: 32724
Reputation: 1204
If you create an Xcode project, then move the .xcodeproj file or the newly created project folder to a different folder using Finder, subsequent builds may show many missing files which still reference the original folder locations (which no longer exist because you moved them). These missing files can appear as red text or as issues in the Issue Navigator.
This can happen when Xcode is configured to automatically add or remove files to/from source control (under Xcode > Preferences > Source Control). When configured this way, simply creating a project in Xcode causes new project folders and files to be marked for addition to source control. When you later move the project folder or .xcodeproj file these pending adds now point to missing files.
To resolve this issue when Subversion is the source control program, revert the pending adds for the phantom items from your local working copy folder. In my case this requires dropping into a Terminal window, navigating to the parent of the phantom project folder, then reverting the automatic add, e.g.
cd /my-working-copy-folder
svn status --depth infinity
svn status --depth infinity existing-parent-folder/phantom-project-folder/
svn revert --depth infinity existing-parent-folder/phantom-project-folder/
Note that the first svn status command will list both missing files as well as properly added, modified or deleted files which you must take care to avoid reverting. The second status command is "practice" for the final revert command, to ensure you've specified the proper path to revert.
I do not know git but I assume it offers corresponding commands.
Upvotes: -1
Reputation: 69
This worked on a Pod project.
I also did this below but now sure if you need it
Quit XCode.
rm -rf project.xcworkspace/xcuserdata/*
Restart XCode and reopen project.
Upvotes: 0
Reputation: 355
you just have to locate the missing file press in file icon in the identity and type you will find the full path just locate your file where do you move it click the file icon
Upvotes: 1
Reputation: 1706
This worked on a Pod project. Quit XCode.
rm -rf project.xcworkspace/xcuserdata/*
Restart XCode and reopen project.
Upvotes: 2
Reputation: 852
Xcode 7
1.) Right click on the red (missing) file.
2.) Select "Show File Inspector"
3.) Look at the right hand side of the screen under "Identity and Type" between "Location" and "Full Path"
4.) Click on the folder icon to the right of the file name.
5.) Navigate to the file's new location in the pop-up window and select the file.
Upvotes: 12
Reputation: 62519
I encountered this issue when copying my project from one mac to another. The solution for me:
assuming your files are grouped (in folder)
from xcode open the group in file inspector
The group will probably be missing the absolute path.
press the little icon nearby to pick the folder to associate the group with.
restart xcode to see the changes.
Upvotes: 10
Reputation: 1
It's too simple to do : Close the project that includes the missed files and open the Xcode, go to "Organizer">"Projects" and remove the project from the list there. Open your project from Finder and that's it.
hope this help.
Upvotes: -3
Reputation: 988
Upvotes: 1
Reputation: 41
I had the same problem, when I changed the permission on the files/folders to everyone read/write they then appeared in Xcode.
Upvotes: 3
Reputation: 2738
Here is how to locate the missing (red) files using the Xcode 4 interface:
Voila, you are done.
Upvotes: 82
Reputation: 19869
Did you move files in to folders directly in your project folder and not in xcode?
Upvotes: 0
Reputation: 19869
I dont know if this is the main reason but when you are importing files to the application, do you mary the "Copy items in to destination group's folder (if needed)" ?
this make sure the file is not only referenced but added to your project folder and ir will move any where you move your project.
Upvotes: 0
Reputation: 12036
When you create these files be sure to save in your app directory. Or if you import classes from other project be sure to check the copy option.
Upvotes: 0