https://cnbin.github.io/blog/2015/05/21/objective-c-class-dump-an-zhuang-he-shi-yong-fang-fa/
Objective-C Class-dump installation and usage
class-dump is a command-line utility for examining the Objective-Csegment of Mach-O files. It generates declarations for the classes,categories and protocols. This is the same information provided byusing ‘otool -ov’, but presented as normal Objective-C declarations.
1. Download the installation package
http://stevenygard.com/projects/class-dump/ ,
here I downloaded class-dump-3.5.dmp. Then put it in the /usr/local/bin
directory, enter it in the terminal class-dump
, after displaying the version of class-dump, you can use the class-dump command normally. After correct installation, it is shown in the following figure:
2. How to use
The command is as follows: class-dump -H /Applications/Calculator.app -o /Users/apple/Desktop/calculate_heads
Explanation: The path of /Applications/Calculator.app
the calculator app is the path /Users/apple/Desktop/calculate_heads
of the folder where the header files from the dump are stored. The
result is as follows:
AppKit and UIKit can be exported using class-dump. . .
class-dump AppKit:class-dump /System/Library/Frameworks/AppKit.framework
class-dump UIKit: class-dump /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/UIKit.framework