miken.mkndev
miken.mkndev

Reputation: 1951

iOS - Create a static library that is dependent on a standard framework

I'm creating a static library for iOS 6 that relies on the built-in Security framework, and I'm having some issues getting it to work. When I build the library, that contains the Security framework, everything builds as expected. However, when I pull in my static library via a new Workspace project into the Workspace my test app is in and try to build the app that includes the library I get some build errors. I have tracked down the build errors to be caused by the Security framework is not being found by the test app. I have added the static library target to my test app and set the header search paths as I have on other libraries, but still get the same errors. So my question is if you include a framwork, such as the Security framework, in a static library, do you also have to include the framwork in the app you are going to use the library in?

Thanks everyone!

Edit: Also, I might add that I have tried to include the security framework in my test app and the errors go away. So I know it has something todo with that not being linked via the library.

Upvotes: 3

Views: 1243

Answers (2)

deanWombourne
deanWombourne

Reputation: 38475

Don't include other libraries in your static one - it can cause all sorts of bother if two static librares define the same symbol (as this google search illustrates :)

You should only include the Security framework in your final apps and should document you static library as having a dependency on the Security framework.

Yea, it's a little messy and I'm sure there are library dependency frameworks out there if you are going to be building lots of static libraries but if it's only a few then this is probably the best approach to take.


EDIT After reading @wattson12 's answer, I've only really covered statically linked dependencies, not frameworks :( His answer covers your situation better.

Upvotes: 1

wattson12
wattson12

Reputation: 11174

Dependancies are not linked by Xcode, so if a project uses your framework, and your framework has a dependency, then that project will need to include the dependancy as well

Upvotes: 1

Related Questions