Andrey Chernukha
Andrey Chernukha

Reputation: 21818

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

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

Upvotes: 10

Views: 5173

Answers (2)

Hot Licks
Hot Licks

Reputation: 47759

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.

Upvotes: 12

antf
antf

Reputation: 3222

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.

Upvotes: 9

Related Questions