2

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?

asked Jun 11, 2014 at 7:14
4
  • 1
    Did you try cleaning then building again? Commented Jun 11, 2014 at 7:19
  • Yes. Even I tried Clean Build Folder option. Commented Jun 11, 2014 at 7:21
  • I know i havent answered your question, but check this tutorial out, towards the end theres some data that might be helpful raywenderlich.com/41377/… Commented Jun 11, 2014 at 7:32
  • I have gone through your frustration before. Commented Jun 11, 2014 at 7:32

2 Answers 2

1

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.

answered Jun 11, 2014 at 7:29
Sign up to request clarification or add additional context in comments.

4 Comments

So we cant use .a files in framework right? For that we need to create binary archives?
The binary archive is, basically, an .a (archive) file. A static framework should not have a binary archive ending in .a, even if the data itself is pretty much the same. A framework needs a specific file layout and Info.plist data to be a framework. From your description it sounds like you have a static library (libMySDK.a, or something similar) rather than a framework. To create a static iOS framework using Xcode 5 there is no template, and there are specific project settings you would need (which are outside the scope of your question).
You are right, there is only option to create static library in xcode 5. But it is possible to create frameworks using earlier versions of xcode. May be I need to find out what those specific project settings are...
It is possible to create static iOS frameworks using Xcode 5. There are a number of limitations with frameworks under Xcode 5, like you can't use the product of a framework target as a dependency within Xcode.
0

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.

answered Jun 11, 2014 at 7:23

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.