ios Xcode 4“清理”与“清理构建文件夹”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8087065/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 15:20:54  来源:igfitidea点击:

Xcode 4 "Clean" vs. "Clean Build Folder"

objective-ciosxcodexcode4

提问by epologee

You come at a certain point in the development of every app that what you see in the simulator does not match what you think should happen. Mostly these are human errors -- or at least they are in most of mycases ;-) -- but sometimes Xcode has just 'lost track', or so it seems. I've learnt that the Clean(Shift+Cmd+K) and Clean Build Folder…(Option+Shift+Command+K) menu options can show the difference between your error or Xcode's.

在每个应用程序的开发过程中,您都会发现您在模拟器中看到的内容与您认为应该发生的情况不符。大多数情况下,这些是人为错误——或者至少在我的大多数情况下都是这样; -)——但有时 Xcode 只是“迷失了方向”,或者看起来如此。我了解到Clean(Shift+Cmd+K) 和Clean Build Folder…(Option+Shift+Command+K) 菜单选项可以显示您的错误或 Xcode 之间的差异。

My question though is:

我的问题是:

What does the Cleancommand do or not do, which leaves a reason for Clean Build Folder…to exist? When should I pick one over the other, why not just always clean the whole folder?

什么是Clean命令做还是不做,留下一个理由Clean Build Folder…存在吗?我什么时候应该选择一个,为什么不总是清理整个文件夹?

回答by Aluminum

If you select Cleanfrom the Product menu, XCode will delete the files inside every folder in the Build folder, if you select Clean Build Folderit will delete the entire Build folder.

如果您Clean从 Product 菜单中选择,XCode 将删除 Build 文件夹中每个文件夹中的文件,如果您选择Clean Build Folder它将删除整个 Build 文件夹。

After Cleancommand:

之后Clean的命令:

enter image description hereAfter Clean Build Foldercommand:

在此处输入图片说明之后Clean Build Folder的命令:

enter image description here

在此处输入图片说明

I think you should select Clean Build Folderwhen you want to build a binary that you want to release to the AppStore, when you messed up with your project or when your app doesn't work for an "unknown" reason, otherwise use Clean.

我认为您应该选择Clean Build Folder何时构建要发布到 AppStore 的二进制文件、何时搞砸您的项目或当您的应用程序因“未知”原因而无法运行时,否则使用Clean.

I hope I've answered your question :D

我希望我已经回答了你的问题 :D

回答by Oliver

Clean…cleans the folders for the current selected target.
Clean Build Folder…cleans the folders for all the targets.

Clean…清除当前选定目标的文件夹。
Clean Build Folder…清除所有目标的文件夹。

回答by Mindy

If you select "Clean", Xcode will delete files inside every folder(e.g., Products, Intermediates) in the Build folder, for the current target. Files for other targets remain.

如果您选择“Clean”,Xcode 将删除 Build 文件夹中每个文件夹中的文件(例如,Products、Intermediates),用于当前目标。其他目标的文件仍然存在。

If you select "Clean Build Folder", Xcode will delete the entire BuildFolder, so nothing left.

如果您选择“Clean Build Folder”,Xcode 将删除整个BuildFolder,所以什么都不剩。

In most cases "Clean" will work for "unknown" reasons, but you still have to "Clean the Build Folder" because Xcode won't delete files in the includefolder inside Productsfolder.

在大多数情况下,“清理”会因“未知”原因而起作用,但您仍然必须“清理构建文件夹”,因为 Xcode 不会删除Products文件夹内包含文件夹中的文件。

回答by user3806037

As of Xcode 10, 'Clean' has effectively disappeared. Apple says here:

从 Xcode 10 开始,“Clean”实际上已经消失了。苹果在这里说

"The new build system uses the "clean build folder" behavior. The legacy "clean" behavior is not supported".

“新的构建系统使用“干净的构建文件夹”行为。不支持旧的“干净”行为”。

回答by DawnSong

Some files at ~/Library/Developer/Xcode/DerivedData/xxx-ABCD, where xxx is the name of your project or workspace, have been deleted after you Cleanor Clean Build Folder.... Obviously, Clean Build Folder...will delete more files than Cleanwill do. However, I think deletion of the folder that I mentioned before is needed in some case, such as your Xcode cannot work properly.

在某些文件~/Library/Developer/Xcode/DerivedData/xxx-ABCD,其中xxx为您的项目或工作区的名称,被后您删除CleanClean Build Folder...。显然,Clean Build Folder...会删除更多的文件Clean。但是,我认为在某些情况下需要删除我之前提到的文件夹,例如您的Xcode无法正常工作。

By the way, something has changed for Xcode 8, Buildfolder is kept all the same after Clean Build Folder...

顺便说一句,Xcode 8 发生了一些变化,Build文件夹在之后保持不变Clean Build Folder...