kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Framework included in the Framework #77

Open shefyg opened 11 years ago

shefyg commented 11 years ago

Hi,

I encountered a problem.

Inside the framework I'm building, I need more than a few Frameworks (such as QuartzCore.framework, MessageUI.framework etc.) If I include them on the "Link Binary With Libraries" section of the Framework Target I'm working on, it wouldn't recognize them. For now it only works if I include them in the project that uses the Framework.

The thing is, I want to include them within the framework, so I don't need to add all of them for each time I use the Framework in new project.

Do you have any idea how to solve this issue?

10x, Shefy

kstenerud commented 11 years ago

As those frameworks are dynamic frameworks, you cannot link them into your own framework or library. There is no concept of implicit dependency with frameworks (alas).

You can only link in static libraries and frameworks (stuff not part of iOS), but even then you need to be careful since linking a 3rd party static library/framework into your own means that you force the end user to use the specific version of that library. Library dependencies are ugly in C/Objective-C.

shefyg commented 11 years ago

ok, thanks.

JanC commented 11 years ago

Hi, I have exactly the same question with static libraries. MyFramework uses some compiled libs (libcrypto.a, libssl.a) and I would like to ship them with MyFramework so that the main application does not have to compile those. Is it a good idea? How can I add them into MyFramework? Currently, if I link the main app only against MyFramework, it does not find the static libraries.

thanks, Jan

kstenerud commented 11 years ago

Hi Jan,

In general, it's not a good idea to link static libraries into your framework because it locks your users into the specific library versions you used to build your framework. Also, if you don't expose that library's header files, and your users want to use those libraries themselves for some reason, they'll try to include the library in their project and get linker errors.

That said, the master branch of iOS-Universal-Framework will only link static libraries if you use a fake framework. The beta branch handles things much better, and will always link in any static frameworks/libraries that you add to the Link Binary With Libraries build phase in your framework target.

The only remaining issue in the beta branch before I merge to master is handling inter-project dependencies when building from command line.

JanC commented 11 years ago

ok I see.

Nevertheless, I do have a "fake" framework project which links against MailCore (It uses some mail functions). Then I have a main app which liks only against MyFramework but it does not compile (MailCore linker error)

Maybe I should try with the beta branch.

MattFoley commented 10 years ago

Our SDK is using about 15 dynamic iOS Frameworks, (I think dynamic is the right term, CoreVideo, AudioToolbox, etc). That's a serious pain for anyone who's integrating the SDK to go through adding, so it's something we wanted to work around.

After reading this thread though, just so I'm clear, it's just not conceivably possible to include these frameworks in our SDK so that our publishers don't have to add them to their project one by one? Thanks!