I have just upgraded to the latest Beta version of XCode and Swift but after using the converter my app project now has over 200 build time yellow errors all stating /"projectDirectoy"/DerivedData/XXXXXXXXX/XXXX/XXX/xXXX/xXX is missing from working copy... where by the XXXXX's represent various file paths in the DerivedData folder.
I have tried deleting the DerivedData folder from the location mentioned in the errors.
I have tried deleting everything in the DerivedData folder in ~/Library/.
I have tried multiple times to clean the project, reboot and do a fresh build.
I have tried turning off source control in preferences but I don't see why I should turn this off as it was on before I updated so I want it left on.
These errors just won't seem to go away.
Any ideas?
I was facing the same warnings after updating to xCode 8 GM, over 350. Most of them where .swift files and images in the asset catalog.
It is basically a Source Control issue that seems to mainly appear when you move/delete project files. These are either new warnings or xCode 8 is just a lot more strict with source control than xCode 7.
After googling about this I found some answers, but they seemed complicated to me e.g using command line or even suggesting turning source control off and back on.
Here is what worked for all my projects.
Short Way
Try this first and if it does not work than do the long way
1) Go to Source Control menu (top menu next to window and help) and click Refresh Status
2) Go to Source Control menu again and click commit
3) The commit window should open with all the commits xCode thinks are necessary. So just enter a commit in the text field box and press the commit button.
Repeat step 1-3 until there are no more items selected by xCode when you open the commit menu. Do not go to step 4 until all the items automatically selected by xCode have been committed otherwise you might get an error when doing step 4.
4) Open the commit window again and as mentioned in step 3 there should be no more items selected by xCode. However you should still see some items in the left sidebar which are the ones causing the warning messages.
Right click on a item and press select all, enter a commit in the text field and than press the commit button. Everything should complete and the warning/errors should go away (optionally press CommitMenu->Refresh Status again).
If it does not complete than close/reopen xCode and than redo step 1-4.
If that also does not work than the long way should fix it.
Long Way
If you use source control and make commits regularly than optionally do step 1 and than you should be able to go straight to step 11.
1) Clean xCode derrived data (Optionally)
You usually dont have to do this so skip this step on your 1st attempt and go to step 3.
Go to xCode preferences, click on the "locations" tab, and then go to advanced. Click on the little arrow next to the advance button to open the path to the derived folder. Close xCode completely and than delete all content that is in that derived folder.
As member Krivvenz has so kindly pointed out in his answer you might have to optionally do this. I did not have to do this myself so maybe skip this and only try it if it doesnt work.
"I also had to change my DerivedData option from relative to Custom which can be found in Xcode > Preferences > Locations Tab."
2) Relaunch your xCode project and wait for the indexing to finish. This might take a few minutes because you just deleted the derived data.
3) Go to Source Control menu (top menu next to window and help) and click Refresh Status
4) Go to Source Control menu again and click commit
5) The commit window should open with all the commits xCode thinks are necessary. I had over 250 as I never used source control before.
6) Click on commit changes at the bottom right
7) I got an error and the operation did not finish (if it works for you than go to 11)
8) Go to Source Control menu and click Refresh Status
9) Go to Source Control and click commit
10) Click on commit changes at the bottom right. This time it suggested about 30 commits less and I got no errors. If you still get errors on your 2nd attempt try closing Xcode completely and than reopening it and than repeat this step.
11) Go to Source Control menu and click Refresh Status
12) Go to Source control menu and click commit
13) This time there should be no changes recommended by xCode but you will still see a lot of files in the commit menu on the left (unticked). Its these files that are throwing the working copy warnings, which should also still be there.
14) Select every one of those files in the left sidebar of the commit menu. You can right click and press check all
15) Click on commit changes at the bottom right
16) I got an error and the operation did not complete. So I tried again and same error, so I closed the commit menu. If it completes for you thats fine too.
17) Go to Source Control menu and click Refresh Status
Boom all the warnings disappeared.
18) Close your project and xCode completely
19) Open your project again
20) Go to Source Control menu and click Refresh Status
21) Go to Source Control menu and click commit
22) I suddenly had 150+ commits suggested again. Make sure all suggestions are selected and than click on commit and it should complete without errors.
23) Clean your project (Product->Clean)
24) Go to Source Control menu and click commit. There should be no changes required and there should also be no files in the left sidebar.
After all this I have no more warnings, didn't need to delete source control and everything is working again as usual.
If you get more errors in the future, say because you moved a file again, than just make commits again, making sure everything is selected.
Hope this helps.