开发者

When and why should I clean the build in XCode

开发者 https://www.devze.com 2023-04-10 00:44 出处:网络
Every once in awhile, the solution to an aggravating problem in XCode is to hit Product → Clean, and this seems to clear some cache and problems开发者_StackOverflow disappear.

Every once in awhile, the solution to an aggravating problem in XCode is to hit Product → Clean, and this seems to clear some cache and problems开发者_StackOverflow disappear.

But what is it actually doing? And more importantly, WHEN should I be doing this? It seems to be necessary more often when dealing with Core Data, but I haven't really been tracking it.

As a side question, WHY is this necessary? XCode seems to do a lot of stuff in the background (autosave, autocompile, etc). Why doesn't this also just happen in the background?


It's because there are a lot difference when you are working with a very very big project with a lot of files and objects. Imagine that you need an hour to recompile a entire project, so you will think before do this. But in our world, this is a fast task.

XCode use the make program. So, it compile only what was changed.

I can list same cases you need do this:

  • Always you will create a App for App Store. This safety thing to do.
  • Always you use the XCode Snapshot. I have bad time when I restore a project and build the app. XCode used old compiled files and a lot of time was lost to search it.
  • Maybe when you restore a old code with git. Is the same idea of the Snapshot
  • When you delete or rename a file in project. It don't delete the compiled file, so the program can work, but if you recompile, will see the errors.
  • When you see that sometime the build have a strange behavior. Or only to have certain that XCode use only your newer files.

I don't remember exactly but i have seen the build use old #defines. Rebuilding can make you more safe about your program. But don't need do this all time.


I am almost certain that XCode loses track of things and sometimes it doesn't recompile (or link, not sure) everything is needed. I have to resort to clean and build all most often than it should. Maybe it's just me, but I doubt it... XCode is the IDE with most bugs I have worked with

0

精彩评论

暂无评论...
验证码 换一张
取 消