Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 autocomplete buggy

do you face also the problems with Xcode 4 autocomplete feature that used to work great on version 3.x.x?

I've imported in the Prefix some classes and Xcode doesn't want to help me with the code entry. I have to manually add above @implementation

import "myclass.h"

To make Xcode help me entering the class name, properties, methods, macros defined in the myclass.h. On 3.x.x I could import those important classes once in the prefix and the autocomplete feature worked without any problems anywhere in the project.

Sometimes Xcode goes even more stupid, it doesn't want me to help typing the classes like UIButton, UIView and the common method like addTarget:action:forControlEvents: for my buttons.

Do you also has the problems I mentioned in the Xcode 4, any solutions?

like image 328
Chris Rutkowski Avatar asked Mar 29 '11 07:03

Chris Rutkowski


2 Answers

I was able to correct this issue by setting Precompile Prefix Header to No in the build settings.

like image 60
rebelzach Avatar answered Oct 22 '22 09:10

rebelzach


EDIT 3: Note that this indexing issues has mostly disappeared in recent versions of Xcode (4.1 for sure, latest pre-Lion 4.0.x I think), and that I do not use this workaround anymore, using pch... And in fact not using Xcode anymore... AppCode ftw! :)


An easy, but quite dirty workaround imho is not using precompiled header .pch file to do global includes, but instead go a global header .h, that you include... everywhere. That way indexing will work flawlessly...

I Know that's dirty, don't downvote me please :) I'll delete this answer as soon as someone propose something better! Which I would love.

Off-topic, but related, read somewhere llvm2 is not supposed to get a gain speed with .pch files. which kind of deprecate them.

EDIT: Just checked to be sure of my answer, latest version of Xcode (4.0.1 when writing this) looks like fixing that bug for me. Did you upgrade to latest version?

EDIT 2: Removed my global import header .h, all its references, and moved my global imports into .pch file... That doesn't work as well I expected, latest Xcode 4.0.1 improved on this part but still have some cases where it fails. (I'm working on a project with hundreds of files). Looks like cleaning index/restarting Xcode fix it. I might consider reverting to my dirty workaround...

like image 35
Vincent Guerci Avatar answered Oct 22 '22 11:10

Vincent Guerci