Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete in Xcode not working as expected (from using other IDE's)

First off let me state that I am an absolute newbie regarding Objective-C and Xcode as I'm coming from a Flash Builder (IDE) / AS3 background. I have recently started learning Objective-C and using Xcode.

I'm now writing my first program and notice that the autocomplete function in Xcode is not working as I would expect it. It is showing me all kinds of values seemingly unrelated to the type of Class I'm using.

If I declare:

NSFileManager *manager;

then if I type manager = [NSFileManager and type command+space here I expect defaultManager to be one of the suggestions. And the suggestions should only be methods and properties of the NSFileManager class. This is how I was used to it in Flash Builder.

Is this a bug in Xcode, some misconfiguration or just not as Xcode is supposed to work?

Autocomplete

like image 962
Fréderic Cox Avatar asked Jul 18 '13 07:07

Fréderic Cox


People also ask

Why is autocomplete not working Xcode?

Go to Xcode > Preferences > Text Editing again. Quit out of Xcode and then relaunch Xcode. Now go to Code completion and check 'Suggest completions while typing'. Try typing library function or enum and enjoy!

How do I autocomplete in Xcode?

Press the escape key when auto-complete makes the first suggestion. This will display the list. Escape or control-comma will show the list, control-period will accept the current suggestion and (subsequently) rotate through suggestions, control-slash will move to the next placeholder argument that was inserted.

Does Xcode have autocomplete?

Xcode tip #9: Xcode has great code completion built right in, but sometimes as you scroll through the options you might find the names are too long to fit. Fortunately, you can just grab the edge of the autocomplete popup and drag it as wide as you want!

Where is the build and run button located in Xcode?

The left-most button is the run button. This will build and run your application and launch your app in the iOS Simulator. The button beside it will stop the execution of your application and return you to Xcode.


2 Answers

I upgraded Xcode 4 to 5 whilst in the middle of a project and found any new files I created in subgroups (equating to subfolders in the project) didn't autocomplete whilst new files in the top folder did autocomplete. I fixed this by setting:

Build Settings ==> Search Paths ==> Always Search User Paths to Yes. All files now autocomplete.

like image 105
pjphilc Avatar answered Oct 22 '22 00:10

pjphilc


As mentioned here there are many reasons and solutions.

For me helped this solution: Go to Preferences > Locations > Derived Data > click the arrow to open in Finder. Delete folder named "Derived Data". And everything works again.

like image 28
Viesturs Knopkens Avatar answered Oct 21 '22 23:10

Viesturs Knopkens