Vivek Mohan
Vivek Mohan

Reputation: 8336

Adding frameworks to Xcode project

I have added a framework to xcode project. Under Build phases->Link Binary With Libraries. The framework consists of a library file (.a file) and a folder "Headers" which includes all the necessary header files for that framework.

Now I am trying to import a header file in the framework to one of my classes.

#import <MySDK/MyHeaderFile.h>

But an error occurs "Symbol not found" while building.

My understanding was that, if we are using framework instead of library file there is no need to add the header files path in "Header Search Path".

But still, I have specified the path to my framework in header search path.

Also I have specified the framework path in Framework search and Library Search path options.

This is first time I am working with frameworks. For libraries I just added the .a files and specified full path to header files in header search path.

What configuration am I missing for adding frameworks?

Upvotes: 2

Views: 1418

Answers (2)

quellish
quellish

Reputation: 21244

If it's a static library file and a bunch of headers, it's not a framework. A framework is a specific method of packaging files. On MacOS X static and dynamic frameworks have one structure, while static frameworks on iOS have a different structure.

For a static framework using Xcode 5, your file structure would look like this:

MySDK.framework/
  en.lproj/
  Headers/
     MyHeaderFile.h
  Info.plist
  MySDK

Where MySDK is the binary archive file (it should not be MySDK.a). If you have a file ending in .a , you have a static library rather than a framework. Building a static framework using Xcode 5 isn't easy but it is also not impossible. Building a static library is much, much easier and trouble free however. It sounds like you already have a static library, so you just have to tell Xcode where to find the library archive and header files using the appropriate search path settings for your project or target.

If/when you DO have a framework, adding it to "Link libraries and frameworks" OR setting "Other linker flags" to "-framework path/to/MySDK.framework" will work fine.

Newer versions of Xcode may support different functionality for building or using frameworks, however linking against them should be largely the same.

Upvotes: 1

Rushi
Rushi

Reputation: 4500

MySDK/MyHeaderFile.h : This explains that your library is inside MySDK folder. Check if it exists in same path. Otherwise you'll get "Symbol Not Found" error.

Upvotes: 0

Related Questions