Get Cocoa source code compiling and running on your iSomething in no more than 24 hours. Read this post.
I. Get a Mac, get a life
1) Register to the iPhone Developer program. it’s not free (~$100), but you won’t be able to put your app on the app store or even test on an actual device if you don’t.
Do this first, it may take up to 24 hours to complete. If your country doesn’t have an online apple store, consider getting remote help as offline registration may take up to 4 weeks to complete, including annoyances.
2) Get a Mac. If you don’t have a mac, you can’t do iPhone. Your mac should be running Leopard 10.5 or higher. Before you head for the corner shop, download the iPhone/iTouch SDK. Avoid using a WiFi connection – download is about 1.2GB.
I got a ‘bigger’ Mac Mini for about $800. That works like a breeze. Rumour has it that the apple dev environment is a memory hog.
3) Install the SDK
4) Dump useless icons from the dock.
5) Download the MoveMe sample application
II – wotf**k
You will use Objective-C and the Cocoa framework for development.
like me, all of the above) you may experience some inconvenience.
The syntax of Objective-C will surprise you – different method calls, different
signatures, never mind using .h files.
There’s a couple of comprehensive tutorials I found useful:
- Objective-C beginner guide, from Tristan O’Tierney.
- A quick Objective-C Tutorial by Scott Stevenson. This focuses on more recent language features.
If you haven’t done much programming, Objective-C is probably not the best place to start. On the other hand, stretching yourself a little might be rewarding as there are many things you can do with apple’s wysiwyg interface builder and not too much programming – either way, you’ve been warned.
I wrote a little note about how to send/view debug output in the console.
III – get your app running on your iPhone/iTouch
1) Follow this link and start the development provisioning assistant. Follow the steps… All this probably deserves an explanation but we’ll keep that for later
2) In xcode, set your environment (top left drop down) to iPhone Device 3.x (3.0, 3.1, …, or whatever works) and hit Build & Run, then one of the following should occur:
- a. the app loads on your iPhone
- b. you get a quizzical exception
- c. you get a message suggesting the phone’s OS is too old.
At this stage, the easiest may be to upgrade the device OS. Obviously
it *should* be possible to build and run on an older target OS, but for now, quickest and fastest. If you plugged your iPhone/iTouch, iTunes would normally offer to upgrade to the latest OS supported by your device.
That’s it. You’re now an iPhone developper :). Next time I’ll look into the Cocoa Touch MVC (Model View Controller) implementation and suggest ways you can design your application.