Objective-C Class-dump installation and usage

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

MAY 21ST2015 10:15 AM

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  imgput it in the /usr/local/bindirectory, 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:

img

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.appthe 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:

img

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325440147&siteId=291194637