Bringing intellisense back from the dead (Xcode)

Guides | Tutorial By 6 years ago

So you’re coding away, everything is coloured nicely so you can distinguish between reserved words, datatypes and variables, but then the unthinkable happens; all your code turns black. Not to worry, you can live without the colours, but when you see the “symbol not found” message and Xcode is no longer autocompleting variables and functions for you, you start the panic. Your development time rolls to a halt and you can no longer quickly jump around from method to method. You realise Xcode has broken it’s intellisense index.

You may scoff, but when this happens you realise how awesome intellisense is and how much it actually speeds up development time if you know how to harness all it’s capabilities.

Bringing it back can be simple, but it can also be gruelling depending on just how broken it is. I will run through a few methods to bring it back, sorted from easiest to hardest.

  1. Quit Xcode. Yep, just quit it and reopen, it may just work
  2. Do a clean. Push command + shift + K or use the Product > Clean menu item. The next time you build everything will be built from scratch, and could bring intellisense back to life
  3. Delete the derived data for the project. Open the organizer by pushing command + shift + 2 or the Window > Organizer menu item and under the Projects tab locate your project on the left, there’s a button for derived data. This will trash your intellisense index database and force Xcode to regenerate it. In theory this should always work, but if it doesn’t (which it hasn’t for me on various occasions) then brace yourself, the next one is not for the faint of heart
  4. Create a new project and move all your source, interface builder and resource files across. This should be your last resort, and very painful

If you know of any other methods, share them below

  • Whirliwig

    Yes, check system.log: the code parser prints out various errors there. Most likely cause is a common header file contains a parsing mistake, killing all files including it.
    To see the parser do its stuff again, delete the derived files for the project, then switch to, to see the parser kick in.

  • Gilad

    THANK YOU!!!

    I was struggling with my project after upgrading XCode. Removing derived data folder finally did it, thanks again!!!

  • Thank You!
    Removing derived data it works.

  • Yeti.or

    3a. Set the deploy target to simulator rather than iOS device. Quit XCode. Checkout version with NOT broken intellisense from your repository. Open Xcode, see that everything is ok. Quit XCode. Checkout back to your current version.

  • With Xcode 5.1, quitting and reopening works for me. Thanks!

  • Ricardo Vázquez Almagro

    Before method #4, you can try this out:

    1) Close the project, leaving XCode still running.
    2) Open XCode’s Organizer window, go to the Projects Tab, select the correct project, and hit the Delete button next to “Derived Data”.
    3) Quit XCode.
    4) Navigate to your project’s .xcodeproject file in Finder. Right-click, choose “Show Package Contents.”
    5) Leave the project.pbxproj file, but delete the project.xcworkspace file, any .pbxuser files, and the entire userdata folder.
    6) Open the project in XCode. You will see XCode riding high on the CPU usage for around 10-60 seconds, depending on the size of your project. The activity window will say “Indexing”
    7) When your CPU spike returns to earth, code completion will be working again.

    After trying your methods (but 4th) with no result, this worked for me!
    I hope this helps.

    • thai tran hong

      Thanks, after trying a lot of methods from many different posts, eventually just your answer fixes my case