欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

iOS如何区分framework是静态库还是动态库

程序员文章站 2022-06-14 23:00:54
...

众所周知,framework是可以做动态库也可以做静态库的,那么我们手头上有个framework,如何区分它的类型呢?

方法:命令行进入动态库文件,使用file命令查看输出内容可以看到区别。以静态库文件-MAMapKit.framework与动态库文件-AFNetworking.framework为例。

1. 静态库文件-MAMapKit.framework

cd /Users/***/Desktop/Framework/MAMapKit.framework
file MAMapKit

输出

MAMapKit: Mach-O universal binary with 4 architectures: [arm_v7:current ar archive random library] [arm64]
MAMapKit (for architecture armv7):  current ar archive random library
MAMapKit (for architecture i386):   current ar archive random library
MAMapKit (for architecture x86_64): current ar archive random library
MAMapKit (for architecture arm64):  current ar archive random library

archive表明这是一个静态库

2. 动态库文件-AFNetworking.framework

cd /Users/***/Desktop/Framework/AFNetworking.framework
file AFNetworking

输出

AFNetworking: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O dynamically linked shared library arm_v7] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
AFNetworking (for architecture armv7):  Mach-O dynamically linked shared library arm_v7
AFNetworking (for architecture arm64):  Mach-O 64-bit dynamically linked shared library arm64

dynamically linked shared library表明这是一个动态库

转载原文地址:https://www.jianshu.com/p/5069778e421a