« Life changes / Non, Je ne regrette rien | Main
April 10, 2008
Apple's new tutorial: writing Cocoa apps for the iPhone
Apple makes a nice, short tutorial available that describes how to get started with XCode, Interface Builder and Cocoa. Apple's development model is built around the "Model-View-Controller" scheme, but it also uses the less common Objective C (2.0) language.
Folks familiar with C and with object oriented programming in general will soon figure things out: the tutorial is written at about the right level.
Nota bene: the first version of the tutorial has a few bugs, as I had to find. At the very end, you need to declare "string" (the "model") as a member of MyViewController:
NSString *string;
I also initialized the string in the init method:
self->string = NULL;
I also ended up using self->string rather than self.string.
Not sure about these things (I'm new to Cocoa), but it worked for me.
The next challenge is to get the sample application to work on a real iPhone. In general, a simple
scp -r ./build/Debug-iphonesimulator/helloworld.app \
root@10.0.0.2:/Applications/
should do the job (having jailbroken and installed an SSH daemon on the phone). Too bad that XCode with the latest SDK will build applications against the new 2.0 (beta) Phone OS. Switching the architecture to "iPhone OS" (rather than the iPhone Simulator) will produce ARM binaries (and complain about a missing certificate, which we'll ignore for now). But running this on a 1.1.4 iPhone? No good.
Posted by dr at April 10, 2008 12:12 AM