What does it do exactly? Can't find an explanation in plain language
-
2maybe [the answers to this question will help](http://stackoverflow.com/questions/5714372/how-to-empty-caches-and-clean-all-targets-xcode-4)? – Michael Dautermann Jan 19 '12 at 18:04
2 Answers
Basically it erases all compiled components, so the next build will build everything fresh. This in theory should never be necessary, since we all know that IDEs are perfect and totally keep track of all source changes and hence know precisely what components need recompiling/rebuilding at any given time. (But, of course, such perfection seems to be a bit elusive.)
The concept of "clean" is found in most IDEs. You use it when things are behaving strangely, or in certain known cases where a "clean" rebuild is required.

- 47,103
- 17
- 93
- 151
A very important usage for "Clean" is when you have images in your application and you update their contents without changing their name. For example say you have an image named Background.png that you used for a while, then you edited this picture in Photoshop and saved the new one in the same name. On the next run of the app the image will not be refreshed; the compiler will continue to show the old one. To make sure to see the updated image you need to do "Clean" before you run. So in principle on all image updates where the name did not change you need to "Clean".
By the way, you might need to "Clean" once for the simulator and once for the real device run. One final note, don't have the idea in mind that every time you write code that you think should work but don't work as you expect then the solution is "Clean", in such a case it is always a problem in your code which needs revision.
-
I believe Xcode 4+ does update the images when it detects a change on them. – EmilioPelaez Jan 19 '12 at 18:59
-
1I am using Xcode 4.0 Build 4A304a and it does not update the images without the "Clean" option. – antf Jan 19 '12 at 19:39
-
Of course a "perfect" IDE would notice that the last change date of the image was different, or have some other scheme for detecting a change. Sometimes it seems that the reliability of such things varies from project to project even within the same IDE. – Hot Licks Jan 19 '12 at 19:51
-
1Yes i can tell you you need to clean after you change images without renaming. At least for app icons. – mskw Nov 30 '12 at 16:22