Xcode 不会删除派生文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35748982/
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-09-15 08:36:26  来源:igfitidea点击:

Xcode won't remove Derived Files

iosxcode

提问by Cayce

I need to figure out why it is that Xcode, suddenly and with no provocation, starts handing me this error and not allowing me to build my project. When I say, "without provocation", I mean I'm editing text in the database the app delivers text from, and checking my progress in the simulator, doing nothing in Xcode at all except cleaning, building and testing. Everything will be fine for several test sequences, then suddenly, changing nothing in my procedures, the app won't build and I get these errors:

我需要弄清楚为什么 Xcode 在没有任何挑衅的情况下突然开始给我这个错误并且不允许我构建我的项目。当我说“没有挑衅”时,我的意思是我正在编辑应用程序从中发送文本的数据库中的文本,并在模拟器中检查我的进度,除了清理、构建和测试之外,在 Xcode 中什么都不做。对于几个测试序列,一切都会好起来的,然后突然间,我的程序没有任何改变,应用程序将无法构建,我收到以下错误:

error: remove /Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living the Eucharist.app/images: Directory not empty

error: couldn't remove '/Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living the Eucharist.app/images' after command failed: Directory not empty

错误:删除 /Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living the Eucharist.app/images: Directory not empty

错误:命令失败后无法删除“/Users/casey-cayce/Library/Developer/Xcode/DerivedData/PEM-LTE-2016-gyoajgqmkkoluhgbrhjmgwakiejl/Build/Products/Debug-iphonesimulator/Living the Eucharist.app/images”:目录不为空

I've gone to this Derived Data folder and physically deleted the contents, only to have Xcode restore those contents when I reopen the app, fail the build, then give me the same errors over again. My only solution so far is to completely delete Xcode and the Developer folder, reinstall Xcode, after which it behaves fora little while, but will eventually do the same thing again. I've done this 3 times so far today.

我已经转到这个派生数据文件夹并物理删除了内容,只是在我重新打开应用程序时让 Xcode 恢复这些内容,构建失败,然后再次给我同样的错误。到目前为止,我唯一的解决方案是完全删除 Xcode 和 Developer 文件夹,重新安装 Xcode,之后它会运行一段时间,但最终会再次执行相同的操作。到目前为止,我今天已经这样做了 3 次。

If anyone has any suggestions, please help me get this resolved so I can get this project exported and finished.

如果有人有任何建议,请帮助我解决此问题,以便我可以导出并完成此项目。

Thanks.

谢谢。

Additional info in response to responses:

I have:
1: Closed the project.
2: Opened the Projects, folder and deleted the Derived Data, seen the Projects folder go blank (empty) with "No Projects" showing in the window.
3: Made sure the trash is emptied.
4: Run "WatchDog," an app developed specifically for dealing with Derived Data issues in XCode.
5: Closed Xcode & re-opened.
6: Opened the project, cleaned, and run the Build command.

After all that, the same errors come up again.

响应回复的附加信息:

我有:
1:关闭了项目。
2:打开项目,文件夹并删除派生数据,看到项目文件夹变为空白(空),窗口中显示“无项目”。
3:确保垃圾已清空。
4:运行“WatchDog”,这是一个专门为处理XCode 中的派生数据问题而开发的应用程序。
5:关闭Xcode并重新打开。
6:打开工程,清理干净,运行Build命令。

毕竟,同样的错误再次出现。

采纳答案by Grigori Jlavyan

It is ok to delete DerivedData folder, you can delete all files from DerivedData sub-folder (Not DerivedData Folder) directly.

删除 DerivedData 文件夹是可以的,您可以直接删除 DerivedData 子文件夹(Not DerivedData Folder)中的所有文件。

That should not take any effect. Contents of DerivedData folder is generated during the build time and you can delete them if you want. It's not a issue.

这应该不会产生任何影响。DerivedData 文件夹的内容是在构建期间生成的,您可以根据需要删除它们。这不是问题。

All contents of DerivedData will be recreated when you build your projects again.

当您再次构建项目时,将重新创建 DerivedData 的所有内容。

I suggest you clean project project and build again, ALSO PLEAE MAKE SURE YOUR DELETED DerivedData folder is not in BINplease clean trash, it is important

我建议您清理项目项目并重新构建,另外请确保您删除的 DerivedData 文件夹不在BIN请清理垃圾箱中,这很重要

回答by JianMing

Check your "Copy Bundle Resources" in Build Phase, You should find some files(should be images in your situation) in that list twice. Delete them and rebuild.

在构建阶段检查您的“复制捆绑资源”,您应该在该列表中两次找到一些文件(在您的情况下应该是图像)。删除它们并重建。

回答by Sanjan Piya

In Xcode go to Window > Projects, select your project and there will be the delete button to delete the derived data.

在 Xcode 中,转到 Window > Projects,选择您的项目,然后会有删除按钮来删除派生数据。

回答by ua24

It's not the best option, but helps me a lot of times - create new project and drag all source files from current in to new one.

这不是最好的选择,但对我有很多帮助 - 创建新项目并将所有源文件从当前文件拖入新项目。

回答by Vittal Pai

As of Xcode 9/10 you'll be able to access the Derived Data folder by navigating to

从 Xcode 9/10 开始,您将能够通过导航到 Derived Data 文件夹

File -> Project Settings

文件 -> 项目设置

or if you use a Workspace:

或者如果您使用工作区:

File -> Workspace Settings

文件 -> 工作区设置

And press the arrow behind the path:

然后按路径后面的箭头:

enter image description here

在此处输入图片说明

Go to the folder and delete the derived data

转到文件夹并删除派生数据

回答by Ronaldo Albertini

Add this to your shell and it will remove the DerivedData

将此添加到您的外壳中,它将删除 DerivedData

rm -rf ~/Library/Developer/Xcode/DerivedData/*