目标:获取iOS9.3的私有和公有API
一. 使用class-dump+DumpFramework.pl
-
注意:一定要使用源码,官网的class-dump在xcode7之后无法获取私有和公有API会报错
Input file (/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk/System/Library/PrivateFrameworks/ChatKit.framework) doesn't contain an executable. -
使用xCode运行class-dump,编译成功后在products中show in finder
-
将class-dump拷贝到
/usr/local/bin
3.1 打开/usr/local/bin目录
open -a Finder /usr/local/bin/
-
设置class-dump的权限
$ chmod 777 /usr/local/bin/class-dump
下载DumpFramewor.pl 放在任意目录,并设置权限
$ chmod 777 /Users/wuyang/Desktop/class-dump/DumpFrameworks.pl-
打开DumpFramework.pl文件,把下面的地址改成自己模拟器的地址
dump_frameworks('/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks', 'Frameworks'); dump_frameworks('/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks', 'PrivateFrameworks');
注意:'Frameworks'、'PrivateFrameworks'一定要换行。这里导出的是模拟器的API,因为class-dump 作用的对象必须是未经过加密的可执行文件,而从 app store 下载的 app 都是经过签名加密的,所以两个iPhoneSimulator.platform地方不能换成iPhoneOS.platform.
-
cd 到DumpFramework.pl的路径,执行
$ ./DumpFramework.pl
至此,公有和私有的头文件已导出到
~/user/Headers
中,commend+shift+h 查看Headers文件夹