166

I recently upgraded to Xcode 4 (which is a great upgrade) but now I'm getting some warnings that I did not get before. I have looked through forums and other SO posts but have not come across how to fix this.

The warnings I get are project level warnings for a missing file. The files that are being shown have been deleted from the project navigator view (also choosing to delete from file system). However it still seems to be showing up as somehow linked to the project, even though the file no longer appears in the Project navigator.

I have looked around and not found how I can tell Xcode that these files are gone, stop giving me warnings. Here's a screenshot that I get in Xcode4, but never got in Xcode 3.

Missing file warning Xcode 4

pkamb
  • 33,281
  • 23
  • 160
  • 191
Scott
  • 16,711
  • 14
  • 75
  • 120
  • If I were you I'd always import your files into your project instead of just keeping a link to them on your disk. It really saves you from headaches if you move files around later. – sudo rm -rf Mar 14 '11 at 15:19

21 Answers21

297

These solutions are way too difficult. The problem is that you have removed the project from filesystem but SVN still thinks they are there. Detaching project from SVN will work, the same for removing .svn folders BUT that is going to destroy your repository!

It is much easier to open console, browse to your folder ("cd /pathToYourFolder") and type the following command:

svn delete nameOfMissingFile

If the name of your missing file includes the @ character (eg: retina-specific artwork), ensure the file name terminates with the @ symbol:

svn delete nameOfMissingFile@2x.png@

For GIT repositories:

git rm nameOfMissingFile

Kiel Gillard
  • 193
  • 1
  • 10
Sulthan
  • 128,090
  • 22
  • 218
  • 270
  • 20
    I had the same issue and resolved it via Terminal using: `svn rm --force nameOfMissingFile` – ReachWest Mar 22 '11 at 21:06
  • delete, remove, rm - they all do the same thing :) – Sulthan Mar 29 '11 at 14:07
  • 1
    This is a better answer than the one marked as correct. Deleting SVN folders from a project under SVN control can be a whole world of pain. Best to use SVN to solve the issue. I followed this answer to resolve my own problem, however I had the luxury of Cornerstone. But otherwise cool. Thanks :) – jowie Jul 08 '11 at 10:52
  • 1
    This doesn't seem to be working for me. I would add the file back, and then delete it, but the same warning still shows up in the build. I even tried to add the files back to the project and then delete them. Still the same problem. – Yenyi Aug 31 '11 at 20:29
  • This worked for some of my files, but not all. In the end I needed a combination of "svn delete", "svn revert" on a few other files, and then finally some cleanup in Organizer for my SVN repository (discard changes in Organizer for my SVN repository got the last two problems resolved). – JasonD Nov 19 '11 at 06:34
  • 10
    It worked for me, but i first had to create a dummy file there before i could delete if using svn. So you have to do **touch nameOfMissingFile** and then **svn delete nameOfMissingFile --force** – Maciej Swic Mar 04 '12 at 14:59
  • 9
    I additionally had to quit and kill xcode for the problem to go away. – Twilite Apr 03 '12 at 16:31
  • Quitting and restarting Xcode solved this problem for me. My underlying SVN repository was all fine, but the Xcode tracking of my Repositories had got in a bad state after doing some additions and deletes. – Dan J Apr 21 '12 at 05:31
  • Disabling SVN entirely in XCode is a good solution to this problem (if you don't need SVN for another Xcode project): http://stackoverflow.com/questions/5466254/can-you-disable-version-control-integration-in-xcode-4 – occulus Jun 28 '12 at 15:37
  • If you use a GUI tool like Versions to manage your repositories, you can also do delete the offending files via the Project browser. – DenVog Jul 03 '12 at 19:14
  • Also, using svn, if you have @2x.png files, svn will choke on the at sign, since it thinks the @ is a version signifier. Add an @ at the end to solve this issue, e.g.: `svn delete Chart_Pt@2x.png@ --force` – avance Oct 08 '12 at 22:58
  • I thought it would be sufficient to delete files in Xcodes (4.5) Organizer / Repositories. It isn't! Had the same error and this answer solved it – jfischer Nov 30 '12 at 10:14
  • I had 400 file missing, but fortunately, in same folder, So I used: **svn delete FolerName**, All thanks to @Sulthan. – mavericks Jan 29 '15 at 10:45
  • I do not understand this. If I delete a file IN XCODE, and tell it to toss it in the trash, why should I ever get this error? Given that SVN is part of Xcode, does it not know what the hell it is doing? I now have 96 files (way too many to delete one at a time with an SVN command) because I no longer needed then, and deleted then IN XCODE. SIGH! – MajorHavoc Feb 07 '15 at 02:02
  • 1
    Works for XCode 8, just had to restart it after fixing the repository. Didn't realize rearranging things in Git was the issue, thank you! – definitelyokay Jul 18 '16 at 05:56
  • In my case it was a directory and I had to do "git rm -r " – zirinisp Sep 15 '16 at 15:25
55

In XCode 4.2.+ (possibly in 4+) you can avoid manual work and command line :

  1. Select project Project Navigator (Command - 1)
  2. Choose File - Source Control - Commit menu
  3. In the left pane, on top of it you have three icons, select the middle one - File view
  4. You will see the list of all missing files
  5. Select all of them and right-click - Discard changes. This will restore all deleted files from the SVN server and place them in your local SVN folder
  6. Drag and drop those files into the XCode project (Choose Sort-Date Modified in Finder to easily find them)
  7. Delete those files properly through XCode (select files and choose right-click Delete)
  8. Commit the project

And that's it :)

All those nasty warnings are gone!

Additionally for Xcode 6+: After selecting the file view 'middle icon' - you can click the checkbox to the left and this will mark them as deleted for SVN when you next commit!

James Alvarez
  • 7,159
  • 6
  • 31
  • 46
Alex
  • 2,468
  • 1
  • 20
  • 16
  • 1
    Only needed upto step 5. I didn't actually have the files in SVN. – Darren Reely Feb 14 '13 at 19:18
  • I had refactored a project, which affected another project cos of some shared code, and XCode was complaining about missing files, related to SVN. Took me a while to figure out it was an SVN issue, after manually trawling through the project source xml and finding nothing. – danfordham May 22 '14 at 12:19
50

In Xcode5 & Xcode6, below steps worked for me

Xcode -> Preferences -> Source Control -> uncheck Enable Source Control

then

Xcode -> Preferences -> Source Control -> check Enable Source Control

Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102
  • On Xcode 8.3.2, this worked for about ten minutes and then all the warnings came right back :( – Bob May 25 '17 at 16:12
27

It has something to do with .svn hidden folders in your project.

I solved this issue by detaching the project from svn.

a. Open terminal and type the following commands:

defaults write com.apple.finder AppleShowAllFiles TRUE


killall Finder

This will allow you to view the .svn folders inside your project

b. Delete every .svn folder in your project folders/subfolders

c. Re-enable hidden files:

defaults write com.apple.finder AppleShowAllFiles FALSE

killall Finder

d. Now your project is detached from svn and you no longer get build issues.

e. Re-add your project to svn or whatever.

I'm a beginner myself and this was my way of dealing with that issue, so I'm not sure this is the best way to go. Anyway, the problem was solved.

sudo rm -rf
  • 29,408
  • 19
  • 102
  • 161
Robert Neagu
  • 498
  • 4
  • 11
  • 3
    Not a good idea to go around messing with SVN hidden folders and files, you could end up in a tangled mess of SVN. Best to use the svn delete command to tidy up missing files. – jowie Jul 08 '11 at 10:53
  • This is the path I actually ended up taking. Yes it deletes all the saved SVN information, but that was actually something someone else had put into a particular project that I did not want to keep. I wanted to start fresh and didn't care about maintaining the particular versioning. – Scott Mar 14 '12 at 20:02
  • I just "killall Finder" by relaunch it. The problem is gone now. Thanks – JHHoang Apr 08 '12 at 15:36
9

This worked for me:

File -> Source Control -> Hide Working Copy Status

then

File -> Source Control -> Show Working Copy Status

SchmitzIT
  • 9,227
  • 9
  • 65
  • 92
Tyson
  • 109
  • 1
  • 6
6

I solved it the following way:

  1. Check the path to the missing file.
  2. Create missing files at appropriate locations within your project directory
  3. Add them to your project using "Add Files to "project"" and create references only (do not copy the files)
  4. The warnings should disappear at this point.
  5. From within Xcode delete the files making sure you click "Delete" instead of the default "Delete Reference Only"
  6. You're done.
askoric
  • 61
  • 1
  • 3
4

I had that bug and found no way to solve it other than creating an empty file on that position and then deleting it. It happened with files I had deleted from the project, and cleaning, building, deleting manually the Derived Data directory didn't work either. I believe it is a bug, and that it can be quite painful if it happens with more than a few files.

Jano
  • 62,815
  • 21
  • 164
  • 192
  • Sad, was hoping there was an easier way around this issue. I have about 20 files, so creating then deleting is going to be quite a pain. – Scott Mar 13 '11 at 23:21
4

I also had this problem, and as user151215 has described it IS due to .svn folders.

I had a old .svn folder, not in the project itself but in the projects parent folder.

the offending .svn folder will have an entries file that contains your missing files. So you can use Teminal and search for a missing file name string, e.g. grep -lir BagController.m yourRootDevDir/*

simpler than enabling hidden files in finder, just use the terminal. cd to relevant directory, and mv .svn ~/.Trash

Hope this helps!

Nick Hingston
  • 8,724
  • 3
  • 50
  • 59
4

Go in to the appropriate directory and run:

svn revert fileName
Shaun McCarthy
  • 1,670
  • 11
  • 9
3

Disabling SVN in Xcode prevents these issues (assuming you're managing your repository with another SVN tool). See this question:

Can you disable version control integration in Xcode 4?

Obviously, this might not be practical if there are other Xcode projects you do want to use SVN with.

Community
  • 1
  • 1
occulus
  • 16,959
  • 6
  • 53
  • 76
3

I used the following way to deal with tha issue:

Launch the terminal and cd to the project directory. (ex: cd /Users/Mauro/Src/Pippero-1.2/ )

Then enter the following command:

find . -name .svn -exec rm -rf { } \;

the command will recursively search for files (and folder) called .svn and delete them

Mauro Delrio
  • 1,941
  • 1
  • 12
  • 12
  • this didn't work for me, but going into each directory and deleting the individual .svn folders did. so big ups to you, my man! – gonzobrains Jul 10 '11 at 20:45
2

I am using svn and manage to solve this problem by

svn delete pathToMissingFile

which is going to remove the local svn copy of the missing file as well as the copy in the remote repository.

or

svn revert pathToMissingFile

which is going to discard changes on the missing file which mean putting the missing file back to where it was.

Jibeex
  • 5,509
  • 3
  • 27
  • 37
1

All the above didn't work to solve the same kind of issue I had. Doing some search, I understood that the issue I had was related to SVN conflicts.

I found out that there were conflicts using the command line:

svn status

Then all conflicted files had to be resolved

svn resolved filename1 filename2 ...

Once the conflicts resolved, the warnings were gone from Xcode

gfrigon
  • 2,237
  • 2
  • 23
  • 32
1
  1. Commit and push your changes.
  2. Restart Xcode.
quemeful
  • 9,542
  • 4
  • 60
  • 69
1

It's very Simple,

Xcode -> Preferences -> Source Control -> uncheck Enable Source Control

and Do not forget to do cmd+shift+k

Senjuti Mahapatra
  • 2,570
  • 4
  • 27
  • 38
Kavin Kumar Arumugam
  • 1,792
  • 3
  • 28
  • 47
0

In my case

  1. I simply open SvnX.
  2. All missing Files are marked in red. Select and delete them.
  3. Then all Xcode Warnings were gone.
The iOSDev
  • 5,237
  • 7
  • 41
  • 78
Apoc
  • 797
  • 1
  • 10
  • 15
0

The answer by Alex fixed my issue of missing files.

I had one other problem ( though it is not related to missing files, i feel this would be the better topic)

  1. I needed to copy a set of images into my project.
  2. I simply created a group (though i know that group doesnt map to the physical folder) and dragged the images into the group (selected "Copy to.." option).
  3. SVN status showed all of them in "A".
  4. Now when I went into actual file system, I found that all images where copied to the root folder of my project. As it didnt look well, I created a physical folder inside the images folder in my project and copied all the added images there.
  5. SVN then showed all files in red.
  6. I deleted the references of all the red files.
  7. With the "Add File" option, I then added the images from the newly created folder.
  8. Now SVN fails to show status of the files as "A", and no way I can check them in.
  9. Tried out many steps like trashing them adding again from a different folder etc, but there wasnt any luck.

I fixed this by going directly into the repository, create a new directory under images so that the physical folder is now in the SVN server

I then took an update of the source, and got the newly created directory inside my working copy (though it is not added to the project).

I then copied the images to that directory and added them to the project using "Add File" option, which brought me back the "A" status and I was able to check in the files.

Just wanted to share this.....because it took a lot of time from me.

-anoop

anoop4real
  • 7,598
  • 4
  • 53
  • 56
  • In this case, go to Terminal and to the root of your project. Create the folder with "svn mkdir name_of_the_folder". Drag & Drop files with Finder from the name_of_the_folder to your Project (or folder it self to add all files). Problem is when you create folder without "svn mkdir" folder is not added to the SVN. – Alex Apr 08 '13 at 20:22
0

Dont delete the file directly in your .xcode folder. Delete files from xcode project navigator. (Right click on that file and choose move to trash).

Now, To clear this issue add same files in same location. And delete from the project navigator.

Gowtham R
  • 215
  • 3
  • 7
0

I didn't have to do anything. I committed my code and pushed it up. Turned off XCODE. Pulled it down again and everything just worked.

VBaarathi
  • 793
  • 8
  • 12
0

Overview:

In my case there was an xcode Project called Sample in the following folder path /folder1/folder2.

There was a .git file inside /folder1/folder2/Sample/ which is expected.

Root cause:

There was another .git file in the parent directory (/folder1) which was causing the issue. The folders might have been deleted leaving behind the .git file

Solution

rm -rf /folder1/.git

Clue

If moving your project to a completely new location fixes the issue where there was no .git file in the parent directories up the hierarchy then it is a clue that the above solution could work.

Community
  • 1
  • 1
user1046037
  • 16,755
  • 12
  • 92
  • 138
0

Press Cmd + 7 after build and select the latest build action. Does it look like good old Xcode a bit? :) enter image description here

knuku
  • 6,082
  • 1
  • 35
  • 43
  • Ya, it looks like the old XCode, but it doesn't solve the problem with the new XCode saying that I have missing files. I like the view, but this seems like it's just masking the issue with XCode. – Scott Mar 13 '11 at 23:19