First off, if you’d like an overview of the iPhone SDK event as well as some quick details, head over to macrumors.com, they’ve done a great job of summarizing the Event [macrumors summary]. The iPhone SDK is a 2.1GB download which you get from Apple’s iPhone developer site – certificates are $99 or $299 [here]. At one point the SDK documentation was publicly accessible but Apple has since restricted it to registered users. The SDK itself still appears to be free (you can signup without purchasing a certificate). What comes with the SDK:
- XCode 3.1 Beta (along with updated utilities)
Quick Note: The iPhone SDK only supports Intel – it will not work if you’ve got a PPC-based system (G3/4/5)
So what are the platforms?
Apple has expanded Xcode to support projects based on a platform. The Aspen.platform directory and MacOSX.platform directories have icons which we see used in Xcode and Instruments to select between platforms for a project or trace. We can also see a glimpse of Apple’s naming process on how to refer to the ‘iPhone / iPod Touch’ operating system; as such, we’ll follow suit and use “Aspen” as well.
Since this is about the iPhone SDK and not Xcode we’ll move right along into Aspen – the simulator and the device. Fire up Xcode to start developing an application and then select a new iPhone Application project where you can select from:
- Cocoa Touch Application
- Cocoa Touch List
- Cocoa Touch Toolbar
You should first note that all three applications have the same thing in common – “Cocoa Touch”. As a part of the SDK Apple has provided the UIKit framework which provides core features required by every application as well as access to device-specific features such as the Accelerometer and Camera. The Cocoa Touch “layer” comprises of the UIKit and Foundation frameworks. It should be noted that the Aspen Foundation framework isn’t the same as the MacOSX Foundation framework.
Of the project templates above, the Application is a basic application which does nothing, the List is a flat list of locales and the Touch Toolbar could be considered the “richest” application as it is a menu bar with Red, Green, and Blue buttons which change the color of the application’s canvas.
After creating a project you can simply Build & Go which will compile and execute the project – when executed your application will open inside of the Simulator. As Apple hasn’t yet issued any developer certificates (I’m waiting on mine), you can only test with the Simulator. When certificates are available you will actually be able to test the application on your iPhone/iPod Touch while it is tethered to your machine. All of this is accomplished by changing the compile settings from Simulator to device. One quick note: Not all simulator functionality is supported on the actual devices and not all device functionality is supported on the simulator. A quick diff of the two “.Platform” directories gives us a quick glimpse of the differences:
e nessence$ diff device simulator
This means some functionality “< ” you’ll only be able to test on the device, and other functionality “> ” you can only build for the simulator. It maybe possible you can build device functionality that’s only in the simulator with some workarounds but I’m sure the better option is to wait for Apple to update the SDK.
In addition to integration with Xcode, you’ll find that Apple’s “Instruments” application which can take advantage of debugging utilities to monitor the performance of your applications. From my testing I could only get some of the traces to work with the simulator while it was obvious I would need to debug the device directly for other traces (Core Animation, OpenGL ES). This only makes sense because you can’t currently compile an application for the Simulator with the OpenGL frameworks.
While it’s evident improvements can be made to the SDK, Apple has done a good job for the first release. Writing a simulator to encapsulate an entire OS is no small feat. The most promising functionality is the level of debugging (and remote debugging) that Apple is pushing to provide by integrating iPhone development into both Xcode and Instruments (ie DTrace).