ios 静态库解压


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

分离arch

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

~  cd Desktop/test
test  ls
staticLibrary.a
test  file staticLibrary.a 
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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

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

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

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

抽离.a文件的object

ar -x v7.a
  • 1

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

获取文件

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

nm View.o > view.m
  • 1

OK 去看一下view.m文件吧


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

发布了172 篇原创文章 · 获赞 35 · 访问量 39万+

猜你喜欢

转载自blog.csdn.net/u012198553/article/details/78132922
今日推荐