Trying to add files, get error message: The operation couldn't be completed. File exists

Tono Nam picture Tono Nam · Sep 1, 2011 · Viewed 13.6k times · Source

I need to replace some images in my application. As a result I deleted them from Xcode and now when I try to add them again I get this error: enter image description here

and I am sure that that file does not exist in the project because I just deleted it. Also when I try to look for that file it does not exist.

Answer

Lio picture Lio · Sep 1, 2011

Try this:

  1. go to the folder were the old image was and place it there again.
  2. go to xcode and click on add files to xcode, select the old image again and add it.
  3. remove the image form xcode both its reference and physically.
  4. add the new image (you can drag and drop to xcode or use add files to xcode)

Hope this helps