.a 文件解析

首先先准备一个静态库.a文件,比如叫staticLibrary.a,放在桌面的test目录里。

分离arch

首先先file一下staticLibrary.a,看一下该文件包含几种arch。

~ cd Desktop/test

test ls

staticLibrary.a

test file staticLibrary.

staticLibrary.a: Mach-O universal binary with 2 architectures

staticLibrary.a (for architecture armv7): current ar archive random library

staticLibrary.a (for architecture arm64): current ar archive random library

可以看到该文件包含两种arch,分别是armv7和arm64。 
由于下面抽离object的时候必须是要单一的库,所以这里我们之抽出armv7并命名为v7.a:

lipo staticLibrary.a -thin armv7 -output v7.a

这时候应该在test目录下多了一个v7.a文件。

抽离.a文件的object

ar -x v7.a

你会发现会多出一些.o文件

获取文件

比如刚才多出来了一个View.o文件,使用以下命令进行获取:

nm View.o > view.m

OK 去看一下view.m文件吧

原文地址:http://blog.csdn.net/showhilllee/article/details/49871363

原文地址:https://www.cnblogs.com/Mr-zyh/p/9501360.html