如何完全删除所有 Xcode 程序和缓存文件? [英] How do I completely remove all Xcode program and cache files?

查看:43
本文介绍了如何完全删除所有 Xcode 程序和缓存文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建了一个新问题 这里有更简单的例子.

Created a new question here with simpler example.

我在 Xcode 中遇到了一些奇怪的行为,包括在我离开它们时编译正常的旧项目中给出不正确的变量值和给我语法错误.

I have encountered some odd behavior from Xcode, including giving incorrect variable values and giving me syntax errors in older projects that compiled fine when I left them.

恢复干净的 Xcode 的最佳方法是什么?Applications 目录中是否存在两个(或更多)Xcode 可执行文件的问题?我一次只运行一个版本...

What is the best way of getting back to a clean Xcode? Are there issues having two (or more) Xcode executables in the Applications directory? I am only running one version at a time...

是否可以完全删除所有程序数据文件和缓存文件,就像我从未安装过 Xcode 一样?

Is it possible to completely remove all program data files and cache files, as if I've never installed Xcode?

如果没有,是否有可以安全删除的缓存/等列表?

If not, is there a list of caches/etc that can be safely deleted?

以下是我迄今为止尝试过的,基于 Stack Overflow 搜索:

Here's what I've tried so far, based on Stack Overflow searches:

  • 清理项目(CMD+OPT+K).重新启动Xcode.重启 Mac
  • 已下载 Xcode 9.4.1.运行这个版本(没有删除Xcode10).可以运行任一版本
  • 已验证的 Swift 版本设置为 4.1(4.2 不是一个选项)
  • 已删除派生数据文件夹.文件>项目设置..点击
    派生数据文件夹旁边的向右箭头.删除了特定项目
    文件.还尝试删除整个文件夹

这是我的长篇故事:我已经在一个项目上工作了大约 6-8 周,在 High Sierra 上使用 Xcode 9.4.1.我是一个新手,所以我创建了一些简单的概念证明"应用程序来了解文本视图、属性字符串、网络视图等.这些小项目中的每一个都编译并运行良好.

Here is my long tale of woe: I have been working on a project for about 6-8 weeks, using Xcode 9.4.1 on High Sierra. I am a novice, so I created some simple "proof of concept" apps to learn about text views, attributed strings, web views, etc. Each of these small projects compiled and ran fine.

我将这些功能组合到一个应用程序中,并添加了一个 Cocoa Pod 库.同样,一切都编译得很好.我正在调试代码中的简单问题.有一次,Xcode 停止在我的代码的变量显示中显示正确的值.我只能使用 print() 语句进行调试,它总是显示正确的变量值.

I combining these features into a single app, and adding a Cocoa Pod library. Again, everything compiled fine. I was debugging simple issues in the code. At one point, Xcode stopped showing correct values in the Variable display for my code. I was reduced to debugging with print() statements, which always showed correct variable values.

我升级 (?) 到 Xcode 10,然后升级到 Mojave 以尝试解决 Xcode 不正确的变量值.出现了其他问题,包括evaluateJavaScript 的已知问题.所以我决定恢复到前莫哈韦沙漠以恢复工作状态.我使用 Time Machine 在 High Sierra 下恢复到 Xcode 10.

I upgraded (?) to Xcode 10, then later to Mojave to try to resolve Xcode's incorrect variable values. Other issues emerged, including known issues with evaluateJavaScript. So I decided to revert back to pre-Mojave to get back to a working state. I used Time Machine to revert back to Xcode 10 under High Sierra.

现在我的项目出现编译错误.即使是我简单的概念验证应用程序也有编译错误.所以我一直试图回到可编译的代码.

Now my projects give compile errors. Even my simple proof of concept apps have compile errors. So I've been trying to get back to compilable code.

我还应该尝试什么来确定发生了什么变化?

What else should I try to determine what has changed?

这是产生语法错误的特定属性字符串代码:

Here is the specific attributed string code that is generating syntax errors:

let titleAttributes = [NSAttributedString.Key.font: NSFont.boldSystemFont(ofSize: 22)]

给出错误:

Type 'NSAttributedString' has no member 'Key'

我在转场时也遇到错误:

I'm also getting an error on a segue:

performSegue(withIdentifier: "showSecondVC", sender: self)

报错

Cannot convert value of type 'String' to expected argument type 'NSStoryboardSegue.Identifier'

为长篇文章道歉.在 Unix 下,很容易将用户帐户或应用程序恢复到已知的初始状态.在 Mac OS X 下似乎要困难得多...

Apologies for the long post. Under Unix, it's easy to get a user account or app back to a known initial state. It seems a lot harder under Mac OS X...

感谢您的建议!

推荐答案

你说的问题好像是 Swift 版本的.

The problems you talk seem originated by Swift version.

为了回答您的问题,当您下载一个新的 Xcode 应用程序(是的,您可以在同一台计算机上拥有多个 Xcode 应用程序)时,一切都在巨大的应用程序中.

To answer to your question, when you download a new Xcode App (and yes, you can have more than one Xcode app in the same computer) everything is inside the huge app.

所有本地数据都在文件夹内

All the local data are inside the folder

~/Library/Developer/Xcode/

您可以在其中找到包含大量数据的多个文件夹.如果您对 Ide 大小有疑问,您可以检查 UserData 文件夹中的IDEPreferencesController.xcuserstate".

Where you can find several folders with lot of data. If you have problems with Ide size you could check the "IDEPreferencesController.xcuserstate" that is found inside UserData folder.

这篇关于如何完全删除所有 Xcode 程序和缓存文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆