Using class-dump

Introduction

Private APIs

Apple exposes several APIs that are public and supported. These APIs are covered in the documentation and promoted by Apple.

There are also many APIs that are not public and used internally by Apple. They are not found in the documentation and are not promoted by Apple. They can be (and have been) removed in the next version of the iPhone OS.

Furthermore, if these private APIs are used by an App that is submitted for AppStore approval, the App will be rejected.

Why Use private APIs?

There are some functions that Apple Apps can do that are not available in the public APIs.

Often, private APIs can provide access to these functions.

What is class-dump and why would you want to use it?

The program class-dump examines the private APIs and generates header files for them.

These header files can them be used by Xcode to access the private APIs.

Getting class-dump

http://www.codethecode.com/projects/class-dump/

http://www.codethecode.com/download/

http://www.codethecode.com/projects/class-dump/changes.html

Using class-dump

Framework locations

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/PrivateFrameworks/

class-dump usage

$ ./class-dump 
class-dump 3.3.1 (64 bit)
Usage: class-dump [options] <mach-o-file>

  where options are:
        -a             show instance variable offsets
        -A             show implementation addresses
        --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
        -H             generate header files in current directory, or directory specified with -o
        -I             sort classes, categories, and protocols by inheritance (overrides -s)
        -o <dir>       output directory used for -H
        -r             recursively expand frameworks and fixed VM shared libraries
        -s             sort classes and categories by name
        -S             sort methods by name
        -t             suppress header in output, for testing
        --list-arches  list the arches in the file, then exit

Calling class-dump

./class-dump -H /Path/to/framework -o ~/Path/to/dump/of/headers/framework 
./class-dump -H \
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/PrivateFrameworks/Celestial.framework/Celestial \
-o ~/Developer/iPhone/class-dump-iPhone3.1.2-Celestial.framework 

Parsing all the frameworks

Perl script

http://arstechnica.com/apple/news/2008/11/dumping-the-iphone-2-2-frameworks.ars


Browse Space

- Pages
- Blog
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

 

Other Features

Add Content