嵌入式二进制文件和链接框架之间的区别是什么

时间:2022-06-17 13:28:28

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

当使用外部框架时,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.

当您下载一个外部框架和查找程序时——>将它拖到Xcode中,它将把框架放在链接框架和库部分。

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

使用Carthage构建库时,建议将其拖放到嵌入式二进制文件部分中。

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.

两者似乎都在链接方面起作用,因为无论哪种方式都可以使用API,更重要的是,将框架添加到嵌入式二进制文件部分时,它也会自动添加到链接框架和库部分。

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

那么,谁是正确的?迦太基还是其他的互联网?为什么在Xcode项目中包含外部资源有两个选项?

3 个解决方案

#1


30  

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

    链接——如果使用框架中定义的任何API,我们必须链接框架。

  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.

    嵌入——这个过程将确保添加的框架将被嵌入到应用包中,并可能有助于在应用程序和任何扩展包之间共享代码。我们只嵌入第三方框架,而不是iOS提供的框架,因为它们在设备中很容易获得。如果我们正在嵌入,这意味着,我们也需要链接到它们,以便Xcode能够编译和创建构建。当应用程序在设备中运行时,嵌入式框架将在需要时加载到内存中。

#2


9  

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 of those programs. In the case 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.

然而,在iOS8中,所有第三方框架都需要“嵌入”。即使是在不同程序之间共享的框架也需要“嵌入”到每个程序中。如果是在共享位置上安装在设备上,那么使用共享位置上相同的“嵌入式”代码的任何其他安装过程都可以重用现有的安装。这是iOS8特有的,在iOS8之前是不可能的,在iOS世界之外,这个答案是不准确的。

#3


-1  

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.

据我所知,嵌入式二进制文件只包含在ios8及以上版本中可用的动态框架,否则只能链接静态的框架。

#1


30  

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

    链接——如果使用框架中定义的任何API,我们必须链接框架。

  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.

    嵌入——这个过程将确保添加的框架将被嵌入到应用包中,并可能有助于在应用程序和任何扩展包之间共享代码。我们只嵌入第三方框架,而不是iOS提供的框架,因为它们在设备中很容易获得。如果我们正在嵌入,这意味着,我们也需要链接到它们,以便Xcode能够编译和创建构建。当应用程序在设备中运行时,嵌入式框架将在需要时加载到内存中。

#2


9  

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 of those programs. In the case 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.

然而,在iOS8中,所有第三方框架都需要“嵌入”。即使是在不同程序之间共享的框架也需要“嵌入”到每个程序中。如果是在共享位置上安装在设备上,那么使用共享位置上相同的“嵌入式”代码的任何其他安装过程都可以重用现有的安装。这是iOS8特有的,在iOS8之前是不可能的,在iOS世界之外,这个答案是不准确的。

#3


-1  

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.

据我所知,嵌入式二进制文件只包含在ios8及以上版本中可用的动态框架,否则只能链接静态的框架。