Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of Product -> Clean in Xcode?

Tags:

xcode

iphone

What does it do exactly? Can't find an explanation in plain language

like image 969
Andrey Chernukha Avatar asked Jan 19 '12 17:01

Andrey Chernukha


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.

like image 129
Hot Licks Avatar answered Oct 06 '22 00:10

Hot Licks


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.

like image 23
antf Avatar answered Oct 05 '22 23:10

antf