嵌入式二进制文件和链接框架有什么区别 [英] What is the difference between Embedded Binaries and Linked Frameworks

查看:124
本文介绍了嵌入式二进制文件和链接框架有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用外部框架时,Xcode现在具有嵌入式二进制文件链接框架部分.

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

下载外部框架并将Finder->拖入Xcode时,它将把该框架放入链接的框架和库部分.

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

使用Carthage构建库时,建议将其拖入 Embedded Binaries 部分.

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

两者似乎都在链接方面起作用,因为无论哪种方式都可以使用API​​,在 Embedded Binaries 部分中添加框架时,它还会自动添加到链接的框架和库部分.

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.

那么,谁是对的?迦太基还是互联网的其余部分?为什么有2种选择将外部资源包含到Xcode项目中?

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

推荐答案

  1. 链接-如果我们使用框架中定义的任何API,则必须链接框架.

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

嵌入-此过程将确保添加的框架将嵌入到应用程序捆绑包中,并有可能帮助在应用程序和任何扩展捆绑包之间共享代码.我们仅嵌入第三方框架,而不嵌入iOS提供的框架,因为它们可在设备中轻松获得.如果要嵌入,这意味着我们也需要链接到它们,以便Xcode可以编译和创建构建.当应用程序在设备中运行时,嵌入式框架将在需要时加载到内存中.

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.

这篇关于嵌入式二进制文件和链接框架有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆