Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C: Can't #import my Framework

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

like image 516
bugfixr Avatar asked Aug 18 '11 20:08

bugfixr


People also ask

Can you still use Objective-C?

Furthermore, Objective-C is a piece of art, creators packed genius solutions and were constantly improving it, so us developers were able to use it at our advantage. There are a lot of indicators telling us there's still a ton of legacy Objective-C code, both from Apple and from other developers, that's still in use.

Will Objective-C be deprecated?

If Swift succeeds, Objective-C will go away. It won't be deprecated, but it'll move to Florida to enjoy its golden years.

Can you write C in Objective-C?

You really can't use C in Objective-C, since Objective-C is C. The term is usually applied when you write code that uses C structures and calls C functions directly, instead of using Objective-C objects and messages.


1 Answers

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.

like image 100
jtbandes Avatar answered Oct 22 '22 18:10

jtbandes