62

I'm using Alamofire in a Swift project, and part of their manual installation instructions are to add Alamofire under Embedded Binaries in the General tab for my application target.

enter image description here

What are Embedded Binaries?

3 Answers 3

56

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. Embedded binaries keep users from having to manually install third-party frameworks. Your application uses the framework you embedded.

In your Alamofire example your application relies on Alamofire. If you didn't embed the Alamofire framework, nobody would be able to use your application unless they installed Alamofire manually. By embedding Alamofire with your application everyone can run your application.

9
  • 3
    The way I recall doing this in the past on OS X on recently with another 3rd party framework on iOS is to build the framework and then create a copy file Build Phase to copy the framework under the "Frameworks" destination. Is this supposed to be a replacement for that? It does seem easier than the way I used to do it. May 11, 2015 at 17:47
  • 2
    Yes, it's supposed to be a replacement to the Copy Files build phase for copying binary files, such as frameworks, libraries, and command-line tools. May 11, 2015 at 18:00
  • 1
    Have you seen any documentation on this Xcode feature? I haven't found any. May 11, 2015 at 18:03
  • I haven't seen any documentation on it, but I haven't looked hard for documentation on it. May 11, 2015 at 18:16
  • 1
    I found one more curious thing in XCode 8. "General -> Embedded binaries" and "Build Phases -> Embed Frameworks" seem to be linked, because if you drag a .framework into one of these places, it automatically appears in the other place also; and in "Embed Frameworks" it automatically enable "Code sign on copy" (signing is important for building your app archives for distribution). Jan 20, 2017 at 18:52
51
  • "Binary" means: compiled code — as opposed to "source code", which is what you are working with when you write code as text.

    They could have given you source code and let you compile it, but they didn't; they are keeping the source code secret, so they've given it all to you after compilation, so that you can't read it.

  • "Embedded" means: to be included inside your app bundle, by copying them into it at build time.

    So, they are handing you some compiled code (frameworks) and telling you how to include them inside your app bundle. These frameworks, unlike Cocoa's frameworks, do not already exist on the device, so if you don't include them inside the app, they won't be present and your app would be unable to call into them.

    Contrast this to Cocoa's frameworks. They, too, are compiled code. But they do already exist on the device. Therefore they are not embedded inside your app; they are merely linked (and, if they appeared, would appear in the next group, Linked Frameworks and Libraries).

2
  • 1
    The fact they're called Embedded "Binaries" as opposed to Embedded "Frameworks" makes me think they're intended to be more general than just for frameworks. Do you know if they're used for anything else besides frameworks? Also, do you have any points to documentation on this? I haven't been able to find any. May 11, 2015 at 17:43
  • 1
    In the more general case, you can also embed a library file.
    – matt
    May 11, 2015 at 17:45
5

Embedding binaries copies the entire framework to the target.

A framework is a hierarchical directory that encapsulates a dynamic library, header files, and resources, such as storyboards, image files, and localized strings, into a single package. Apps using frameworks need to embed the framework in the app's bundle.

So, when you embed a framework in your app, it increases the size of your app because it is copied to you app bundle. In most of the scenarios we will be using this sections when we are using third party framework.

When we add a framework to Embedded Binaries it automatically adds that framework to Linked Frameworks and Libraries also.

Refer to apple documentation for more details: https://developer.apple.com/library/archive/technotes/tn2435/_index.html

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.