Dilemma meets opportunity: iPhone beta SDKs in review
Will you tread the Cupertino path?
iPhone SDKs are like buses these days, the appear so frequently. Since my introductory piece on iPhone development, Apple has rolled out an initial SDK preview, a second iteration of the SDK (Beta 2) while a third beta followed not long behind. The second beta included the much-anticipated Interface Builder application but Beta 3 actually makes it work.
So what are you getting from Apple? Turns out an interesting bag of technology that comes with some philosophical choices for developers over whether they work with Apple or follow their own path, independent of the company, building iPhone applications.
First, the good news: the iPhone SDK is free to download and is essentially a set of add-in tools and libraries for the existing Xcode development system.
The bottom line is that, with the SDK installed, you can choose whether you want to create iPhone or "regular" Mac applications, all with the same development tools. This is obviously a lot more convenient than using a Cygwin-based toolchain under Windows, which is what I alluded to in my earlier piece.
The SDK includes a cute, on-screen iPhone simulator that you can use to test and debug many iPhone applications directly from Xcode without deploying to an iPhone. Opinions differ about whether it's a simulator or emulator but I'd go with the former.
Xcode generates an x86 application for the simulator that is itself an Intel executable and uses a set of frameworks that provide the same API as the actual ARM executables in the device. In other words, no ARM code is involved during a simulator run.
The new firmware is notionally version 1.2, although it will be rechristened 2.0 when it officially hits the iPhone. At the moment, you can only run 1.2 on the simulator. At least, officially.
Now some bad news. As mentioned, Beta 2 included Interface Builder and offered the ability to visually lay out the various elements of an iPhone application. Sadly, Interface Builder wasn't as well integrated with Xcode as it should have been. If you're still working with Beta 2 and can't figure out how to make things work, look here. But ideally, you should already have upgraded to Beta 3, in which case you'll find that Xcode obligingly adds a MainMenu.xib file to a new project, and double clicking it launches Interface Builder, just as a Cocoa developer would expect.
Another issue you might run into - I did - is that if you've previously downloaded the sample iPhone applications, they will no longer work after you install a new beta.
This happened to me when I went from Beta 1 to Beta 2, and again when I went to Beta 3. This is primarily due to API changes. The solution is to simply re-download the updated samples from the Apple web site. You can find an official list of API changes between Beta 2 and Beta 3 by clicking here. The previous delta document - Beta 1 to Beta 2 - has disappeared, so if you've written a lot of Beta 1 code that no longer compiles, you're on your own.
Apps in store
Technical gotcha's aside, the commercial and legal limitations are much more interesting. As you'll no doubt have heard by now, Apple is introducing the App Store with the release of the 2.0 firmware.
Think of it as iTunes for applications. From their iPhone, users will theoretically be able to browse, purchase and download third-party applications with (presumably) a mechanism for alerting the user when an updated version of an application becomes available.
Apple will get 30 per cent of the cash made on a sale, with the remainder going to the developer. That's not too unreasonable when you consider that a small developer can forget about the hidden costs of web hosting, publicity and credit card fees - everything is done through App Store.
To be able to sell applications in this way, you have to register as an iPhone developer, which costs $99. Crucially, if you don't register as a developer, you won't even be able to deploy an application to a phone running the 2.0 firmware. This is because a registered developer receives a special key that the compiler uses to digitally sign applications. If the firmware doesn't find a valid signature within the application, then it won't run.
RE: Hindsight is a wonderful thing...
Thanks, Eliakim for your insightful, tightly-argued, and perceptive debating skills. Or not.... ;-)
Hi zato. I would never disagree that you should use the documented API's wherever possible, but in this case Apple are clearly using the "don't touch undocumented API" strategy to limit what third-party developers are allowed to do in relation to Apple's own apps. That's the key point.
Check out Jonathan Zdziarski's blog at http://www.zdziarski.com/ where you'll see he's built a Nintendo simulator for the iPhone. Point here is that Jonathan is using a lot of private/undocumented API calls, and none of this stuff is changing from one iteration of the SDK to the next. Why not? Because this is the real API that Apple use internally. The official, documented API is just a tightly restricted subset of this. To me, that can't be right. Background/foreground app issues aside, Apple are simply not providing a level playing field for third-party developers.
Hindsight is a wonderful thing...
The only hindsight that the author, Dave Jewell, has -- is -- hindsight up his own rear end...