views:

1088

answers:

3

There are a handful of iPhone apps out there doing some behind-the-scenes trickery with undocumented APIs, with effective results.

1) How would I go about getting a listing of undocumented iPhone APIs?

2) Are there third-party off-the-cuff documentation for some of these APIs?

+3  A: 

You could use classdump to get a listing of the iPhone SDK, but I don't know about the (non)existence of third-party documentation. You could probably get an idea of what the methods do by reading their names, though.

computergeek6
+2  A: 

Erica Sadun, one of the most well respected iPhone hackers has a book out on precisely this. Most of the undocumented header files can be pulled from her website too.

slf
A: 

I've found a perl script(source= arstechnika), wich builds a folder of headers from the public and private frameworks of the iPhone SDK. However I get an error (class-dump failed, returning 16777215 ), if i run it.

    #!/usr/bin/perl
#
# 24 November 2008
# Framework Dumping utility; requires class-dump
#

use strict;

use Cwd;
use File::Path;

my $HOME = (getpwuid($<))[7] || $ENV{'HOME'} 
  or die "Could not find your home directory!";

# This command must be in your path.
# http://www.codethecode.com/projects/class-dump/
my $CLASS_DUMP = 'class-dump'; 

# Public Frameworks
dump_frameworks('/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks',
                'Frameworks');

# Private Frameworks
dump_frameworks('/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/PrivateFrameworks',
                'PrivateFrameworks');

sub dump_frameworks
{
  my($dir, $subdir) = @_;

  opendir(my $dirh, $dir) or die "Could not opendir($dir) - $!";

  # Iterate through each framework found in the directory
  foreach my $file (grep { /\.framework$/ } readdir($dirh))
  {
    # Extract the framework name
    (my $fname = $file) =~ s/\.framework$//;
    print "Framework: $fname\n";

    my $headers_dir = "$HOME/Headers/$subdir/$fname";

    # Create the folder to store the headers
    mkpath($headers_dir);

    # Perform the class-dump
    my $cwd = cwd();
    chdir($headers_dir) or die "Could not chdir($headers_dir) - $!";

    system($CLASS_DUMP, '-H', "$dir/$file");

    if(my $ret = $? >> 8)
    {
      die "$CLASS_DUMP failed, returning $ret\n";
    }

    chdir($cwd) or die "Could not chdir($cwd) - $!";
  }
}
Markus Scheucher