Archive for October, 2008

iPhone hackery: API Explorer

Wednesday, October 29th, 2008

I wrote the offline Wikipedia browser back before there was any official iPhone SDK documentation (or SDK, for that matter), and figuring out the APIs was a bit of a challenge. So in trying to get a handle on things, I wrote an API explorer for showing a rough outline of the system’s classes. It started out as a bare-bones script, and since then I’ve gradually bolted various bits on to it.

Unlike many compiled languages, Objective-C supports pretty powerful runtime introspection. The explorer uses this to present the implemented protocols, methods and instance variables of every loaded class. In addition, if the class responds to initWithFrame: (these are usually subclasses of UIView), you can draw and resize an instance, to get a basic feel for what it does.

It’s all more easily explained with a short screencast:





If you want to play around with it (it works in both the simulator and on the devices themselves), you can download the code.

Worth remembering

Monday, October 20th, 2008

Economic theory suggests that financial innovation must lead to failures. And, in particular, since successful innovations are hard to predict, the infrastructure necessary to support innovation needs to lag the innovations themselves, which increases the probability that controls will be insufficient at times to prevent breakdowns in governance mechanisms. Failures, however, do not lead to the conclusion that re-regulation will succeed in stemming future failures. Or that society will be better off with fewer freedoms. Although governments are able to regulate organisational forms, they are unable to regulate the services provided by competing entities, many yet to be born. Organisational forms change with financial innovations. Although functions of finance remain static and are similar in Africa, Asia, Europe and the United States, their provision is dynamic as entities attempt to profit by providing services at lower cost and greater benefit than competing alternatives.

—Myron Scholes (yeah, that Scholes), debating Joseph Stiglitz.

Wikipedia iPhone redux

Sunday, October 19th, 2008

Back at the start of the year, I blogged about an app I wrote that allows you to store a complete copy of Wikipedia on an iPhone/iPod Touch.

The app got more attention than I expected, with tens of thousands of downloads in the first month, which I think made it one of the more popular apps for the jailbroken iPhone. (Not anticipating any of this, the non-existent documentation and installer ensured many were confused, and so someone made a YouTube installation tutorial that has over 57,000 views at time of writing. I’m not sure if that’s good or bad.)

I also released the app’s source code, and it’s been pretty fun to work with a lot of talented people in improving it. The OLPC crew took an interest in it, and thanks to some cool work from Chris Ball and Wade Brainerd, the iPhone application was ported to the XO laptop. Chris announced in June that:

We’re going to be shipping the result to Peru on tens of thousands of laptops in the near future, and it should go up to hundreds of thousands if the other South American countries with OLPC deployments decide to include it in their builds too.

When the iPhone 3G was announced, I didn’t originally intend to port the application to the new version of the OS. The original app was a short Christmas project, and now that I’m working at Live Current, I don’t have much spare time to hack. But after a few hundred emails enquiring about a new version, I eventually felt too guilty not to. So I spent a weekend porting it to iPhone OS 2.0, added a handful of new features, and I’m happy to say that the end result is now available in the App Store.