class-dump
2018-06-05 本文已影响6人
hare27
1. 下载
http://stevenygard.com/projects/class-dump/
2. 安装
- 1> 下载完后,打开安装包,拖动【class-dump】到"/usr/bin/",OS X 10.11 之后要复制到"/usr/local/bin/"
- 打开命令行,执行命令赋予其执行权限:
ios$ sudo chmod 777 /usr/bin/class-dump
OS X 10.11 之后是
ios$ sudo chmod 777 /usr/local/bin/class-dump
3. 使用
class-dump -a -A -s -S -H /Applications/Calculator.app -o /Users/hare2j/Desktop/calculate
class-dump -H /System/Library/Frameworks/AppKit.framework -o /Users/hare2j/Desktop/headers
class-dump /Users/hare2j/Desktop/headers
4. 命令说明
-H 输出头文件内容,可以-o指定输出目录
-o<dir> 放在-H后面用户指定输出目录
-s 根据名字进行对类名和协议进行排序
-S 根据名字对方法进行排序
-a 显示实例变量的偏移量
-A 显示实例方法的地址
--arch<arch> choose a specific architecture from a universal binary (ppc, ppc64, i386, x86_64)
-C <regex> only display classes matching regular expression
-f <str> find string in method name
-I sort classes, categories, and protocols by inheritance (overrides -s)
-r recursively expand frameworks and fixed VM shared libraries
-t suppress header in output, for testing
--list-arches list the arches in the file, then exit
--sdk-ios specify iOS SDK version (will look in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS<version>.sdk
--sdk-mac specify Mac OS X version (will look in /Developer/SDKs/MacOSX<version>.sdk
--sdk-root specify the full SDK root path (or use --sdk-ios/--sdk-mac for a shortcut)