Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embedded Binaries with iOS Framework

Tags:

ios

frameworks

I was able to create iOS Framework for Xcode as shown in that video:-

https://youtu.be/86cPaa3FrRg?t=4m55s

On 5:00 they say that framework must be added to Embeded Binaries. If I add it to Embeded Binaries then it works.

It is not required to add GoogleAds.framework to Embeded Binaries. Adding to Embeded Binaries looks a bit "hacky" comparing to Googles solution. So I think this tutorial is missing some step.

My question is: How can I make a framework that works without adding it to Embed Binaries?

like image 869
Tema Avatar asked Apr 30 '15 10:04

Tema


People also ask

What are embedded binaries?

Embedded binaries are binary files that are copied to your application bundle when you build the project. Use embedded binaries when your application relies on third-party frameworks so people can use your application without needing those frameworks installed on their machine.

What is embedded framework in Xcode?

Xcode supports the concept of embedding frameworks into your bundle. This is essentially the same thing as the old “Copy Files” build phase where you can copy a dependency into your app bundle under a particular directly, such as “Frameworks”.

What is binary framework in iOS?

Binary Frameworks A binary framework is already compiled source code with resources with a defined interface that you can use in your apps. It comes in two flavors: a static library and a dynamic framework.


Video Answer


2 Answers

tl;dr They are both frameworks, but they are different types.


The term "framework" is ambiguous. On OSX it means a packaged dynamic library (i.e. .dylib, headers, other stuff), however before iOS 8 users could not create dynamic libraries so "static frameworks" were invented to provide packaged static libraries (i.e. .a, headers, other stuff).

If the framework you created needs to be packaged with the app as an embedded binary then it sounds like a dynamic framework, however if Google Ads doesn't then I suspect it's a static framework. It doesn't need to be embedded as it's already been linked into the app binary.

If you want to know how to create a static framework, then start here, or Google for "ios static framework".

like image 116
trojanfoe Avatar answered Oct 10 '22 10:10

trojanfoe


Prior to iOS 8, developers shipped unsupported frameworks that were cobbled together with static libraries by mimicking the directory structure of Apple's frameworks. They worked, but they were a pain to build, and they were static—not dynamic—libraries.

As of iOS 8, Apple officially supports building third-party dynamic frameworks in Xcode. These types of frameworks are code-signed and must be placed in the Embedded Binaries for your app. If you link against them but fail to put them in Embedded Binaries, you will get an exception when attempting to run on device and your app will crash.

In the long-run, I would expect the hacked together frameworks like GoogleAds.framework to disappear now that official framework support is available. This means you'll have to get used to putting frameworks in Embedded Binaries.

Unless you need to support iOS 7 with your code (in which case official frameworks are not an option, because they only work on iOS 8), I would advise against creating an unsupported type of framework at this point.

like image 9
emaloney Avatar answered Oct 10 '22 11:10

emaloney