gpt4 book ai didi

ios - 为什么 Apple 不允许在框架中使用静态库?

转载 作者:行者123 更新时间:2023-12-01 22:11:01 28 4
gpt4 key购买 nike

Appole doc

它指出:

If you are building your own static library and using shell scripts to package it in a .framework directory, you need to migrate to building a framework with a dynamic library instead, as this is the correct way to build a framework. Static frameworks are not a supported way of sharing static libraries.



为什么 Apple 不允许在框架中使用静态库?

它是这个 post 的缩写吗? ?
或者也许那个帖子混淆了 static librarystatic framework ?

iOS 中的所有框架都是动态的,对吧?
苹果说:

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.

最佳答案

应用程序启动时必须加载静态库,而不考虑是否立即需要。另一方面,动态库仅在需要时才加载,从而提高了应用程序的启动时间并降低了手机的内存压力。

例如,考虑我正在使用一个电子商务应用程序,该应用程序还允许扫描条形码并提供有关产品的详细信息。现在,当我启动应用程序时,我将不再需要条形码功能。我需要先登陆应用程序并开始购物。当我需要扫描一些条形码时,我很乐意等待并让框架加载,而不是在应用程序启动时加载。

以下是 Apple 在其文档中的说明:

Two important factors that determine the performance of apps are their launch times and their memory footprints. Reducing the size of an app’s executable file and minimizing its use of memory once it’s launched make the app launch faster and use less memory once it’s launched. Using dynamic libraries instead of static libraries reduces the executable file size of an app. They also allow apps to delay loading libraries with special functionality only when they’re needed instead of at launch time. This feature contributes further to reduced launch times and efficient memory use.



文档链接: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/OverviewOfDynamicLibraries.html

关于ios - 为什么 Apple 不允许在框架中使用静态库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53292959/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com