21

Since I had Xcode 4.4, I have lost the completion when I want to import file on my classes. I have to write the file entirely (The problem appears only in the import scope, it works elsewhere)

Has anyone the same problem and know how to figure out ?

booker
  • 1,256
  • 1
  • 12
  • 18
  • I have this problem sometimes with Xcode 4.3 – dasdom Jul 27 '12 at 12:28
  • same problem... really inconvenient, hoping for someone to save the world – Tranz Aug 02 '12 at 01:53
  • happened to me once, but now working again. Please file a bug report with Apple. – Kaan Dedeoglu Aug 02 '12 at 15:36
  • Did you tried to close the project and to delete the project in the Organizers project area? – Bernd Rabe Aug 02 '12 at 15:49
  • Rather than say "I have it too", why not just upvote the first person you agree with? – Andy Aug 02 '12 at 21:45
  • I doubt this would resolve it but it might be a problem with how the project is indexed by Xcode. Try cleaning the project and then clean the project folders (hold down alt while accessing the project menu and you'll see it replace the "clean" menu entry) – Mattia Aug 03 '12 at 21:12
  • Check this thread: http://stackoverflow.com/questions/5431501/xcode-4-code-sense-is-not-working –  Aug 16 '12 at 02:06

2 Answers2

27

Go to your project --> build settings --> User Header Search Paths and add $(SRCROOT)

That works for me.

Edit (another solution) : Sometimes I lost autocompletion randomly in my import scope. I fix it by typing the double quotes #import "" before typing my class between with the autocompletion.

booker
  • 1,256
  • 1
  • 12
  • 18
8

Apparently this is related to having your files inside subfolders. It seems that while previous versions of Xcode's codesense would list any headers added to your project, version 4.4 only lists the ones in the topmost folder in your project...

The solution I've found is to include those subfolders in the project's "User Header Search Paths".

For example, if you have a folder structure like this:

Source/
  Example/
    Util/
      util.h
  Example.xcodeproj

By default, when you type

#import "u|"

you'll get the suggestion for the Util folder. If you let it complete that and continue typing:

#import "Util/u|"

you'll get the util.h suggestion.

To get the usual autocomplete behavior, go to your project --> build settings --> User Header Search Paths and add Example to the list (double click on the setting, click the "+" button, write Example and make sure to turn on the checkbox to the left). When you close the little pop up, your setting should read something like Example/**, which means it's including Example and every subfolder.

The new behavior (feature? bug?) was driving me crazy. Hope that helps.

Mariano Ruggiero
  • 737
  • 4
  • 15
  • To include all files in your source, use this : `"$(SRCROOT)/**"`. This works great, it's been driving me crazy for weeks, thanks!! – Jess Bowers Aug 24 '12 at 17:22
  • This actually didn't work right of the bat for me, and was driving me insane... I had to remove the path that I had already set in the "Header Search Paths", and then add it in the "User Header Search Paths". Now, everything works properly. – Mazyod Aug 04 '13 at 18:29