What is the difference between Embedded Binaries and Linked Frameworks

IosXcodeFrameworksXcode7Carthage

Ios Problem Overview


When using external framework Xcode now has an Embedded Binaries as well as Linked Frameworks section.

enter image description here

When you download an external framework and Finder->drag it into Xcode, it will place the framework into the Linked Frameworks and Libraries section.

When you build a library with Carthage it recommends dragging into the Embedded Binaries section.

Both seem to be working in terms of linkage, as the API becomes available either way, further more when adding a framework into the Embedded Binaries section is it also automatically gets added into the Linked Frameworks and Libraries section.

So, who is right? Carthage or the rest of the internet? and why are there 2 options for including external resources into Xcode projects?

Ios Solutions


Solution 1 - Ios

  1. Linking- We must link a framework if we use any API defined in it.

  2. Embedding - This process will ensure the added framework will be embedded within the App bundle, and potentially will help sharing code between the app, and any extension bundles. We embed only third party frameworks and not the ones provided by iOS as they are readily available in the device. If we are embedding, that means that, we will need to link to them too so that Xcode can compile and create the build. When the app runs in the device, then the embedded framework will be loaded into memory when needed.

Solution 2 - Ios

If you embed the binary it will be included into your product. If you only link a library or framework without embedding it, it will not be part of your product.

However, in iOS8 all 3rd party frameworks need to be "embedded". Even a framework that is shared between various programs needs to be "embedded" into every single one of those programs. In the case where it was installed on the device in a shared location, any other installation process using the same "embedded" code from the shared location can re-use that existing installation. This is specific to iOS8, it has not been possible before iOS8 and outside the iOS world this answer would not be accurate.

Solution 3 - Ios

Linking more about Linker that works at compile time or load/run time. Linker copy a Library into a target binary. Since Framework is autonomous, the Linker, in this case, is responsible for find and link the Dynamic Framework inside the system loader path or to find and link inside a bundle.

Embedding is a process of copying the binary into the target binary. As a result it will be located inside.

Read more here

Solution 4 - Ios

> Linking- We must link a framework if we use any API defined in it.

> Embedding - This process will ensure the added framework will be > embedded within the App bundle, and potentially will help sharing code > between the app, and any extension bundles. We embed only third party > frameworks and not the ones provided by iOS as they are readily > available in the device. If we are embedding, that means that, we will > need to link to them too so that Xcode can compile and create the > build. When the app runs in the device, then the embedded framework > will be loaded into memory when needed

.

Solution 5 - Ios

To my understand, the embedded binary only includes dynamic framework that is available on iOS 8 and above, otherwise you can only link the framework that is static.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMaxim VekslerView Question on Stackoverflow
Solution 1 - IosShripadaView Answer on Stackoverflow
Solution 2 - IosBastiView Answer on Stackoverflow
Solution 3 - IosyoAlex5View Answer on Stackoverflow
Solution 4 - IosMenon HasanView Answer on Stackoverflow
Solution 5 - IosLei ZhangView Answer on Stackoverflow