1

XCode gives me an error that cannot find header file, but command-clicking on the header opens the header file. The strange behaviour is that in another class of the same project the same header file is recognized. This header is inside a custom framework. I correctly import it with

#import <CustomFramework/FancyHeader.h>

XCode Version 6.1.1 (6A2008a)

What I have tried:

  • Quit XCode,
  • Clean project,
  • Delete Derived data

But with no luck.

Edit

I noticed that I cannot import it in more than one file. What might be the problem?

Narrowing down:

A.h, A.m, B.h, B.m


Works

A.m:

#import A.h
#import B.h
#import <CustomFramework/FancyHeader.h>

Does not work if I add in B.h

#import <CustomFramework/FancyHeader.h>

Please help! :)

4
  • is the framework listed in your linked frameworks for your project settings on all targets you'll be needing? Commented Feb 24, 2015 at 23:29
  • I have only one target and yes it is listed? it works if I import the header only in one file Commented Feb 24, 2015 at 23:30
  • you were right, i had also TEst target. It works!!! thanks Commented Feb 24, 2015 at 23:33
  • I would like only to know why??? Add it as an answer to accept it Commented Feb 24, 2015 at 23:34

1 Answer 1

1

I just generally go by:

For OS X software developers the guideline for including header files and linking with system software is straightforward: add the framework to your project and include only the top-level header file in your source files.

Source: Apple Docs

But in a general sense, defining the target of a framework lets your app know the scope to use those resources. It also allows for you to import those libraries into a targeted project. And it determines what resources your app will need to load into memory in order to work properly.

The guide I've linked explains the framework in better detail. And it's also worth checking out the Project Editor Help docs

Sign up to request clarification or add additional context in comments.

1 Comment

Interesting how Xcode allows you to drag a framework into the project but is not intelligent enough to add that framework's directory to the search paths for framework header files. Kinda basic stuff...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.