266

After deleting/adding some png files to project, i have got messages when building project.

"file ProjectPath\aaa\xxx.png is missing from working copy."

All these files are in the project, and the application is running. However, these messages are annoying. Looked .plist file, but there is no mention of these files. What should I do to remove these messages?

Iban
  • 2,851
  • 2
  • 12
  • 8
  • Can refer https://stackoverflow.com/questions/39711061/xcode-8-missing-files-warnings/44347658#44347658 – Shrawan Jun 03 '17 at 19:35

24 Answers24

494

The warning will disappear as soon as you commit your changes (Xcode 8).

Alexander Vasenin
  • 11,437
  • 4
  • 42
  • 70
  • 2
    Found that I just had to commit my changes under git after moving some files to a different directory. – Chris Livdahl Aug 20 '16 at 04:10
  • @LearnSwift Clean Cmd+Shift+K, delete ~/Library/Developer/Xcode/DerivedData/*? – Alexander Vasenin Sep 16 '16 at 21:51
  • 2
    @AlexanderVasenin neither – Learn Swift Sep 19 '16 at 13:43
  • 7
    For me simply staging changes was enough. Good to know. – charmingToad Sep 21 '16 at 18:52
  • @LearnSwift you are not alone my friend. I pushed my code twice but still have 92 warnings. – Blind Ninja Nov 06 '16 at 13:35
  • 13
    As you mentioned, I did make sure to Commit and Push my latest changes. But doing just that did not remove the errors. So then I did Xcode > Source Control > Discard ALL Changes, and it cleaned up all the errors for me. – EdwardM Jan 24 '17 at 18:29
  • This latest commit worked for me. I had a particular issue when deleting .xcdatamodel files in .xcproject. Subsequent warnings in .xcworkspace disappeared (if of interest, see my original issue which was resolved by following this commit changes advice here: http://stackoverflow.com/questions/43403412/cannot-edit-xcworkspace-contents-file/43410320#43410320) – MikeLondonUK Apr 14 '17 at 11:09
  • you also have to restart xcode after commiting changes. only then errors will disappear. – Adam Smaka Apr 15 '17 at 07:50
  • when you commiting your files be sure to select all files to commit and problem should solve. – emresancaktar Apr 25 '17 at 10:40
  • @EdwardM make sure you added all those file paths that are giving you the missing warning – Shubham Naik May 10 '17 at 06:23
96

It seems that this problem may have different causes, but it's often in relation with source control software.

In my case, I solved it by going to Git, and adding the files again. I mean running the following command:

git add .
nbloqs
  • 3,152
  • 1
  • 28
  • 49
  • After installing Xcode 8 and upgrading the code to swift 3 I ended up with over 300 issues that needed syntax corrections (massive project). Instead, I restored from a backup and upgraded to swift 2.3 ... all went well except for a bunch of these 'missing' messages. This command worked like a charm - I'm back in business! – Dan Ross Sep 17 '16 at 21:24
  • This is what worked for me. The issue started when I removed what I used to had in Pods in favor of Carthage – Sebastian Sastre Oct 14 '16 at 22:41
  • 1
    This works for me too. It seems that the file is under source control and git needs to get updated also. – Shardon Oct 21 '16 at 16:39
  • after git commit the warning disappeared – Carmen Nov 28 '16 at 09:47
  • 3
    For others: you have to located in the root folder of your Xcode project with executing the 'git add .' command: /MyXcodeProjects/AwesomeApp/ –  Dec 17 '16 at 09:51
  • if you want a finer control `git status` will show you the files to add and then `git add your_filename` – vib Mar 26 '17 at 20:30
  • Going to XCode -> Source Control -> Add xxx.xxx did the trick for me. – nyxee May 28 '17 at 17:32
59

You can also disable source control by unchecking

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

if you're managing it via command line or any other app.

emrekyv
  • 1,256
  • 1
  • 18
  • 21
  • this did it for me, kind of annoying to see this in the IDE, they should either support source control well or none at all – samiq Jan 03 '17 at 20:13
  • 1
    I have done two actions :1) "uncheck", 2) "check" for Enable Source Control. Warnings was disappeared. – Viktor Jul 26 '17 at 13:58
58

In XCode -> SoureControl:

Update + Refresh Status did it for me.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
coyer
  • 4,122
  • 3
  • 28
  • 35
  • I'm thinking this may be due to images having "@" in the filename, such as the "@2x" and "@3x" convention. SVN uses that symbol for revision syntax (to escape it when working with SVN in the command line, you simply add an "@" at the end as the last occurrence is the one it uses to try and determine revision info). Simply running Update worked for me. When I added some new images, I actually had to manually select "add" on the 2x/3x variants in the File Inspector pane as well. Weird. – Android3000 Mar 24 '16 at 17:22
  • 1
    This! so Important. The issue also comes if you rename a folder containing files. In other words, xcode gives us warnings because we haven't commited our code yet! *clap clap clap* – Warpzit Aug 02 '16 at 12:58
  • 4
    This worked for me. I had to close Xcode and open the project again and run. – jaytrixz Sep 20 '16 at 05:09
44

In my case, the file was missing from the source control.
To fix, I had to discard this file (be careful only discard the missing file not all your project):

  1. Xcode->Source Control->commit
  2. Right Click the missing file
  3. Choose Discard Changes
Ronen
  • 1,225
  • 13
  • 10
  • It works for me, I did remove the DerivedData folder, and warnings were for files as "db.xcindexdb" – tontonCD Dec 02 '16 at 10:19
  • 1
    First, I made sure to Commit and Push my latest changes. Then I did Xcode > Source Control > Discard All Changes, and it cleaned up all the errors for me. – EdwardM Jan 24 '17 at 18:26
19

Disable Source Control, clean build folder (Alt+Shift+Cmd+K), then Enable Source Control again.

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

George
  • 756
  • 1
  • 9
  • 16
  • 1
    correct answer... but the exact answer @emrekyv posted 3 months previous... He gets the vote up – eric Feb 10 '17 at 19:03
  • @eric he suggested just to disable source control, I showed how to make it work correctly. – George Feb 13 '17 at 12:43
18

In my case, Xcode had somehow found old .svn directories that referenced the missing files. I had to go up a level above my project folder to find those .svn files. Once deleted, I restarted Xcode and everything was fine.

kubi
  • 48,104
  • 19
  • 94
  • 118
  • Yes, this happens when you delete something from a project under version control when it is still referenced by version control (in my case, svn). Using "svn update" to restore the missing files, then deleting them the proper way using "svn delete", made the issue go away for me. – Chrissi Apr 25 '16 at 13:40
12

I had a similar issue with a handful of files that had long since been deleted from my Xcode project while I was still using Xcode 7.

My solution was to:

  1. Create files with the names Xcode was complaining about (they don't need any content)
  2. Add the files to my Xcode project (in Xcode right click on my main project directory, click Add files to my_project_name and select the files that were just created
  3. Select the newly added files and delete them - select move to trash.

This got rid of the warnings for me.

  • This worked for me, too. I had the issue after copying an existing project to make a derivative, but with cut down functionality ⇒ less source files. – Stefan Dec 19 '16 at 14:16
9

To add onto Alexander Vasenin's answer...

First I Committed and Pushed my changes

Xcode Main Menu > Source Control > Commit

Then I Discarded All Changes to get rid of the errors

Xcode Main Menu > Source Control > Discard All Changes

After that, the errors stating "file xxx.png is missing from working copy" disappeared.

EdwardM
  • 1,116
  • 11
  • 20
  • What if the project does not use version control or a version control system not supported by XCode. – Martin Jun 06 '18 at 07:09
8

This is occurred when you delete file on Xcode, but didnt tell svn server about it.

Go to command line tool, and delete file directly.

svn delete missingFile.m 

and commit it

svn commit -m "Deleting file"

note that if you delete .svn folder, the warning is disappear but you will lost communication with svn server.

Pokemon
  • 494
  • 10
  • 22
5

I worked it out.

just open your third-party SVN tool, find the miss files, Revert; that's all.

traximus
  • 177
  • 3
  • 15
5

I had same problem and solved it by add git . Open Command Line Tool

cd "project folder path"
git add .

Later,restart Xcode project and open your project again.

Ugur Atci
  • 167
  • 2
  • 7
4

Show on target->build phases -> copy Bundle Resources. and clean build folder command+shift+alt+k

BHASKAR
  • 1,201
  • 1
  • 9
  • 20
  • 3
    Thanks, but they are not in the Build Phases, and cleaning build folder does not help too. – Iban Aug 16 '14 at 09:01
4

I had to manually go into Terminal and remove the files with git rm ProjectPath\aaa\xxx.png and then commit. After that everything worked fine.

yesthisisjoe
  • 1,987
  • 2
  • 16
  • 32
3

Got this for every project after moving on to XCode 8. This solved it:

With Option Key pressed, Product (in title menu) -> Clean Build Folder.

TomV
  • 1,157
  • 1
  • 13
  • 25
2

In my case, I had wrong data from my old projects in the simulator. Solved by reset content and settings in the simulator:

Simulator -> Reset content and settings...

Channel
  • 2,183
  • 21
  • 16
1

For me the following worked:

Since I do not and did never use Git, I created a new project (XCode 8, I could not see the usual "use Git" or however the checkmark was labeled). Then I bluntly deleted all the files in this new project; went to the old messed up project, copied everything in the project folder, came back to the newly created project, pasted the old stuff, opened that - all the warnings about files that have not been existing for months are gone. Fingers crossed.

1

I had the same issue and solved it by simply dragging the specified files from finder into the project navigator (ensuring that "copy files" is selected in the dialog) and committing the files.

JohnSF
  • 3,736
  • 3
  • 36
  • 72
1

These warnings are not build warnings, they are about your SVN repository.

It is correct that the directories shown no longer exist, CocoaPods stores the headers in Pods/Headers/{Private,Public} now. You have to update your working copy to reflect those changes.

Mutawe
  • 6,464
  • 3
  • 47
  • 90
1

In my case I drag & dropped a number of files on my Xcode project window to add them. It made copies into my source directory but didn't put them where I wanted them to go (it put them at the root of my directory, I wanted them in a sub-directory). Without thinking I just grabbed them in the Finder and moved them to the directory I wanted them in. After going back into the project window it of course could not find them so I deleted them in the window and re added them. After compiling I started getting these errors.

I thought, as some mention above that it was a git issue but when I ran "git ls-tree --full-tree -r HEAD" I didn't see the files at all??

Anyway to fix it all I did was use the "Add File..." menu command to add each of the files to the default location, do a clean build, and then delete them from the project window (using move to trash) and it got rid of all the errors.

KevinR
  • 153
  • 1
  • 9
1

I had the warnings, and also could not commit changes under XCode (using svn). All I had to do was restart XCode and the problem went away.

Hugh Jeffner
  • 2,936
  • 4
  • 32
  • 31
1

This works for me: Xcode -> ("option + click") Product -> Clean Build Folder...
Than restart xCode

Mykyta Savchuk
  • 1,195
  • 13
  • 13
0

In my case it was a problem with git and a case-insensitive file system.

I had inadvertently submitted the same file twice, using file paths that differed only in case:

MyProject/Resources/foo.png
MyProject/resources/foo.png

Xcode was complaining about one of the missing files.

Fixed by deleting the offending files, and re-adding.

cd MyProject
mv Resources/foo.png /tmp
git rm Resources/foo.png
git rm resources/foo.png
git commit
mv /tmp/foo.png Resources
git add Resources/foo.png
git commit
Darren
  • 25,520
  • 5
  • 61
  • 71
0

This is definitely related to source control. I renamed and moved a couple of non-committed plist files and got this error. I am using svn. I was able to fix this via Source Control - Commit by removing old referenced files.

Hahnemann
  • 4,378
  • 6
  • 40
  • 64
  • I got the problem and I don't use version control XCode is aware of. All version control done outside XCode. – Martin Jun 06 '18 at 07:11