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

标签 ios xcode frameworks static-libraries binaryfiles

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/

相关文章:

ios - 如何在应用商店中运行 tvOS 应用

ios - "No such module"归档时出错

ios - swift 3 : Instance Member cannot be used on type “View Controller”

swift - 去除白色状态栏框

iphone - 在 xcode 中构建并运行禁用

ios - 混合语言框架

xcode - 如何针对 namespace 冲突强制执行编译器警告或错误?

应用程序启动崩溃的 iOS BugSense 堆栈跟踪

ios - 隐藏导航栏但也保留状态栏的背景颜色

objective-c - mapViewDidFinishLoadingMap : called too early