The unflappable free software community that opened the iPhone

by Andrew Oram

This article was originally published on January 15, 2008 on O’Reilly Media’s OnLAMP web site.

The world of free software is full of amazing and even heroic stories (the gcc toolkit for its quality and flexibility, Linux and free desktops for their size and sheer ambition, Samba and Mono for their tenacity at keeping up with confusing quasi-standards) but one of my favorite recent stories is the opening of the iPhone.

Apple did a beautiful job creating this device. Millions wanted it the moment it became known, and thousands wanted to write programs to explore its ground-breaking interface elements. Apple, however, failed to release its APIs, much less any toolkit or run-time environment.

So the community built its own.

The process was “not pretty,” according to one of the leaders in this community, Jonathan A. Zdziarski. They had to break into a chroot jail, disassemble code, and figure out all the hooks into the runtime.

They were aided by the relatively unmangled output of the Objective-C language, as well as tools such as class-dump that can reveal the symbols in the code. Basically, Objective-C does a lot of dynamic, run-time evaluation, so its libraries have to preserve symbols and other valuable linker information. However, parts of the interface were in C, which offers fewer hints to code spelunkers.

And as Jonathan points out, learning how to interface with the iPhone’s framework didn’t mean they had learned how to use it. After figuring out the iPhone’s many APIs, developers were inundated with hundreds of less-than-meaningful prototypes. Several months of work went into what the scientific community refers to as “screwing around” with the framework to figure out exactly what methods and overrides produced the desired functionality for each piece of the framework.

They were also helped by Apple’s use of a variant of BSD for the operating system, and by the similarities many APIs had to published desktop APIs. Apple knew a good thing when they created Leopard, so much of its APIs reappear on the iPhone. Still, there are subtle differences.

The result? Just a few months after the release of this closed platform, a community of volunteers had a full set of libraries and tools for developing applications fully as rich and capable as Apple’s own offerings. It’s all available freely for download under a BSD license.

Now for the moment to reveal the shameless promotion behind this blog. Jonathan Zdziarski has written a book for O’Reilly on this toolkit. Having edited, I can see that his perspicacity as a hacker is matched by his clarity of thinking as an author.

Expectations are that Apple will release its own SDK in February. But it’s not known yet what restrictions may be imposed. The open toolkit is available now, without restrictions.

Within a week, we should have a RoughCut (a preliminary online release of an O’Reilly book) up on the O’Reilly web site. Of course, we’ll cover the Apple toolkit too, as soon as we can.

But even if the Apple toolkit becomes dominant, the story of the iPhone open development community will remain a monument to the power of free software development.

Author’s home page
Other articles in chronological order
Index to other articles