Lost completion in #import “myFile.h”

 ̄綄美尐妖づ 提交于 2019-11-30 04:45:02

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!