Stack Overflow
Find Me
Tweets
Goodreads
« Goodbye, Steve | Main | BackBlaze, MDS Worker, and Spotlight »
Thursday
Sep292011

Quick Xcode 4 Tip: Deleting Derived Data to Rescue Code Completion

Quick Tip:

I had an issue on a very large project in XCode. Starting 2 days ago, all of my syntax highlighting was completely broken. This is bad, but even worse, my code completion worked only partially. I was getting autocomplete for local variables only. When calling framework methods with a lot of parameters, I rely pretty heavily on code completion. I tried all of the usual fixes. This includes:

  1. Doing a Project Clean (⌘⇧K)
  2. Doing a Clean Build Folder (⌥⌘⇧K)
  3. Restarting XCode

None of these solutions fixed the issue. After some digging, I came across this StackOverflow Post which pointed me in the right direction. Seems like sometimes the project index, which contains metadata used to display code completion suggestions (among other things), can become corrupted. The solution is to delete it. This will force XCode to regenerate it, which rebuilds the index.

Here are the steps to delete your Derived Data folder.

  1. Go to XCode Settings (⌘,)

  2. Click the Locations tab. You will see a screen like this:

  3. Locations 1
  4. Click the small arrow next to the location of the Derived Data folder. This will open the Finder to the location of the Derived Data for any XCode projects you currently have on your Mac.

  5. Find the one that starts with the name of your current project and delete it.

  6. You should immediately see XCode start to re-index your project

For me, after this process completed, I got all of my functionality back. Your mileage may vary, and please make sure you back everything up before deleting anything!

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (2)

Had exactly the same issue, worked perfect for me.
You saved my productivity today, thanks!

March 22, 2012 | Unregistered CommenterAndi

@Andi, glad it helped!

March 22, 2012 | Registered CommenterMark.Struzinski

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>