简体   繁体   中英

How do I completely remove all Xcode program and cache files?

Created a new question here with simpler example.

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.

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...

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?

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

  • Clean project (CMD+OPT+K). Restart Xcode. Reboot Mac
  • Downloaded Xcode 9.4.1. Running this version (didn't delete Xcode 10). Can run either version
  • Verified Swift version was set to 4.1 (4.2 was not an option)
  • Deleted Derived Data folder. File> Project Settings.. Clicked on
    right arrow next to Derived data folder. Deleted specific project
    file. Also tried deleting entire folder

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.

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.

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)]

gives error:

Type 'NSAttributedString' has no member 'Key'

I'm also getting an error on a segue:

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

gives error

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

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...

Thanks for any suggestions!

The problems you talk seem originated by Swift version.

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/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM