iOS是静态还是动态框架? [英] iOS is it a static or a dynamic framework?

查看:404
本文介绍了iOS是静态还是动态框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能听起来像一个愚蠢的问题但是如果你有一个thirdParty.framework文件,你能告诉它是静态的还是动态的?我的意思是,如果你看里面它们看起来有什么不同吗?

This might sound like a silly question but If you have a thirdParty.framework file, can you tell if it's static or dynamic? I mean, do they look different if you look inside?

推荐答案

它可以是。

但是,只有iOS8 +才允许应用程序包中的动态框架。

Only iOS8+ will allow dynamic frameworks in the app bundle, however.

查找方法是查看 .framework 并在主文件上使用文件命令:

The way to find out is to look in the .framework and use the file command on the main file:

$ cd iOS/Crashlytics.framework
$ ls -l
total 9984
-rwxr-xr-x  1 andy  staff  4710656 11 Sep 17:11 Crashlytics
drwxr-xr-x  8 andy  staff      272 11 Sep 17:11 Headers
-rw-r--r--  1 andy  staff     1553 11 Sep 17:11 Info.plist
drwxr-xr-x  3 andy  staff      102 11 Sep 17:11 Modules
-rwxr-xr-x  1 andy  staff   146164 11 Sep 17:11 run
-rwxr-xr-x  1 andy  staff   241688 11 Sep 17:11 submit
$ file Crashlytics 
Crashlytics: Mach-O universal binary with 5 architectures
Crashlytics (for architecture armv7):   current ar archive random library
Crashlytics (for architecture armv7s):  current ar archive random library
Crashlytics (for architecture i386):    current ar archive random library
Crashlytics (for architecture x86_64):  current ar archive random library
Crashlytics (for architecture arm64):   current ar archive random library

其中 ar archive 表示静态库。

或者,动态框架将如下所示,并明确声明它是动态链接的。

Alternatively, a "dynamic" framework will look like this and explicitly state that it's dynamically linked.

$ cd /Library/Frameworks/iTunesLibrary.framework/
$ ls -l
total 40
lrwxr-xr-x  1 root  wheel   24 10 Sep 17:38 Headers -> Versions/Current/Headers
lrwxr-xr-x  1 root  wheel   24 10 Sep 17:38 Modules -> Versions/Current/Modules
lrwxr-xr-x  1 root  wheel   26 10 Sep 17:38 Resources -> Versions/Current/Resources
drwxr-xr-x  4 root  wheel  136 10 Sep 17:41 Versions
lrwxr-xr-x  1 root  wheel   22 10 Sep 17:38 XPCServices -> Versions/A/XPCServices
lrwxr-xr-x  1 root  wheel   30 10 Sep 17:38 iTunesLibrary -> Versions/Current/iTunesLibrary
$ file Versions/Current/iTunesLibrary 
Versions/Current/iTunesLibrary: Mach-O universal binary with 2 architectures
Versions/Current/iTunesLibrary (for architecture i386): Mach-O dynamically linked shared library i386
Versions/Current/iTunesLibrary (for architecture x86_64):   Mach-O 64-bit dynamically linked shared library x86_64

这篇关于iOS是静态还是动态框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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