6

I'm just learning Objective-C, so this is going to be a pretty basic question. I've created a Mac OSX Cocoa Application and added it to a Workspace in XCode 4.

I also created a Cocoa Framework project named "Module" and added it to the same Workspace. By default XCode created a Module.h and Module.m for me which I've left unchanged.

I've seen lots of articles about how to add the framework to the project by going into the Build Phase and clicking the + in the "Link Binary With Libraries" section. I've done this and now see a toolbox in my main Application project that says "Module.Framework"

So now my next question is - how do I #import that into my main app? I tried various combinations using " and <, but all attempts report as file not found.

Help? :)

EDIT: Added some screen shots

Workspace

enter image description here

bugfixr
  • 7,997
  • 18
  • 91
  • 144

1 Answers1

4

As long as Module.framework is in your project (your main project, not the other project), you should be able to use #import <Module/Module.h>. Also, make sure you have set up a dependency so Xcode knows to build your framework before trying to build the main project.

Community
  • 1
  • 1
jtbandes
  • 115,675
  • 35
  • 233
  • 266
  • My main application project lists "Module.framework" as the very first sub item under the project. I added `#import ` to my main app's header file. When I build, it says "Module/Module.h' file not found. Also, my dependency list shows nothing when I try to add this to it. – bugfixr Aug 18 '11 at 20:41
  • Aah! Sorry, thought this was a different question. I'm answering too many Xcode questions at the same time. :) – jtbandes Aug 18 '11 at 20:58
  • Hm, now I'm having a problem trying to set this up too. Perhaps you should just find the framework in Finder and add it to your project... though I think this should work, I'm just not sure why it doesn't! – jtbandes Aug 18 '11 at 21:05