Filed under: Education, Developer, App Store, SDK
Dear Aunt TUAW: How do I get started programming for the iPhone?
Dear Auntie TUAW,
I've been thinking about trying my hand at development for the iPhone (I've got some good app ideas already), and I was wondering where a good place to start might be. Should I mess around with learning some Objective-C first, or just spend the $99 and dive in with the dev kit? I know some PHP, Javascript, and a smattering of C++, but have never tried developing in Objective-C or Cocoa.
I have some free time this weekend to try messing around with development and see if it's something I might be able to do. Where's a good place to stick my toe in and see if the water's good for swimming? Should I buy an Objective-C book and spend the whole weekend with that, or is it worth it to put down the money on a dev kit and see what I can make my iPhone do?
Let me know! Just thinking of you, there's this scent in the air... like a mixture of 4711, hard candies and Aqua Net.
Your devoted nephew,
Mikey
My Darling Mikey,
No need to spend that $99 when the SDK is free. You can go ahead and sign your soul away to Apple without paying a penny by joining the free online developer program. If you decide that iPhone programming is "your thing," you can join the paid yearly developer program when you're ready.
As for programming, not having a strong C background can certainly be an obstacle. C, specifically Objective-C, is the iPhone core programming language. Knowing Objective-C and how to use Cocoa are the development keystones.
Amazon has Steven Kochan's excellent Objective C book for sale -- but the new version will be out in a matter of weeks. If you can, grab one from your local library. This allows you to hold off on buying until you can get the new shiny version.
Hillegass' Cocoa Programming just went into its third edition and is nicely updated. It's the standard Cocoa "bible" that many developers recommend.
Unfortunately the news is not so good on the iPhone-specific front. Jonathan Zdziarsky's Open Application Development book does not go past Firmware 1.1.3 (it was written in the Fall of 2007) and it covers none of the SDK. Many of the firmware calls listed in that book are obsolete, and since you have an App Store goal in mind, you will find yourself going down the road of unsupported or private APIs.
You can't buy an SDK development book because the NDA prohibits those books going to press. Apple's official Cocoa Dev mailing list regularly reminds participants that iPhone specific discussion is off-limits. (Be aware that the noise quotient on CocoaDev is pretty high and that tempers often flare.)
You can also search online for one of the many private forums, IRC servers, and mailing lists that developers have established despite Apple. Many local dev organizations have sprung up, particularly in the Bay Area but how each group handles the NDA issues varies.
Apple does provide lots of yummy sample code. Download and adapt that code however you wish. These are great starting off points for people well-versed in Objective C and Cocoa. They're not such great starting points for anyone not fully conversant with those skills. The code is not written pedagogically. There are tons of classes, the comments tend towards administrative rather than tutorial, and you have to get your mind into the Apple Engineer mindset -- which can be an uncomfortable thing but is easily treated with ointments and creams.
Between Kochan and Hillegass and sample code, you have a good chance of figuring it all out in time -- but probably not over a weekend and probably with a certain degree of discomfort.
I wish I had better news for you, Mikey but good luck all the same.
Love,
Auntie TUAW


![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 3)
Justin said 7:53PM on 9-25-2008
Javascript experience is going to help you more then PHP. Obj-C/Cocoa are nothing like a scripting language... C/C++ experience puts you ahead of the game though, do to experience with object oriented design patterns. Ruby and Python are also great choices as starter languages for OO.
As for how it is to program Cocoa for the iPhone... you can pretty much take any of the popular books and tutorials (current editions) and apply them to the iPhone by reading some of Apple's online documentation (re: Cocoa differences between Desktop and Mobile OS X).
Reply
Ed said 9:00PM on 9-25-2008
Why would JavaScript help more? PHP has very similar syntax to C++ and has proper classes, which JavaScript doesn't.
Justin said 9:46PM on 9-25-2008
Ed: Yeah, PHP has classes which are pathetic and only mainly used for namespacing... also there is no virtual table in the PHP "engine", so static variables are bound with a name instead of a reference at compile time. If you knew anything about Objective-C you'd understand my point.
Javascript is a prototype based language, similar in some respects to Smalltalk... something Obj-C greatly models after. Prototype classes greatly reflect Obj-C's interfaces (headers). Also, Javascript's prototypes are dynamic during runtime, just like Obj-C's dynamic typing (the exciting part about Ruby).
I understand PHP had its day... and I hear the script kiddies whine all the time about it.
evantravers said 7:30PM on 9-25-2008
Wow. Thanks! This is very tempting, seeing as I just heard that the makers of that triangle based puzzle game are making ridiculous sums of money.
(Success, no proper nouns in the comment.)
Reply
Jash Sayani said 5:33AM on 9-26-2008
Yeah and people are even getting Sample code aqnd submitting in the AppStore and earning money. Example- LunarLander in AppStore.
Alex Paris said 7:43PM on 9-25-2008
IVE BEEN LOOKING FOR THIS!
Thanks :)
Reply
David Macdonald said 7:50PM on 9-25-2008
Mikey,
There is a good chance that Apple will reject any application you develop. You will spend months developing an application only to be rejected. Also the non-disclosure agreement will mean that after you are rejected you will not be able to tell anyone. I recommend you try to develop an application for Googles's Android - it is open source and you are guaranteed to not be rejected.
Reply
Justin said 7:56PM on 9-25-2008
Is that what the Android people preaching? Are you nuts?
Does anyone really enjoy developing UI's using XML configuration files on your Java SDK? Please...
::stamp:: FUD!
David Macdonald said 8:01PM on 9-25-2008
I'm sure the developer of Podcaster enjoyed spending months writing code in the wonderful iPhone environment - only to be to told at the end of it to go to hell.
LuminousNerd said 8:06PM on 9-25-2008
Yeah, there's a "good" chance you'll get rejected...if by "good" you mean about 1/1500.
Seriously, there have been A FEW developers who got rejected! People complained at first because practically nothing was getting rejected, and people thought they should regulate it better! Now they reject like 3 people, and everyone throws a hissy fit and tries to scare away new iPhone developers!
I'm not saying I agree with the way Apple is handling things, but saying "there's a good chance you'll get rejected" is just plain ridiculous.
If you develop an app that doesn't do something Apple already has an app for (even though it may have better/additional features) and your app is clean/not profane, and follows basic UI guidelines, then you're golden. There is VERY little if any chance of getting rejected.
David Macdonald said 8:21PM on 9-25-2008
... "Yeah, there's a "good" chance you'll get rejected...if by "good" you mean about 1/1500"...
Well, explain that to the rejected developers. They spent a lot of time developing an application for the iPhone. Months and months, only to be told that all there time was wasted. The Apple iPhone development environment is too restricted.
Bauer22 said 9:34PM on 9-25-2008
That's the chances you have to take. Sure, there's a chance that you may be rejected but there's a even better chance that you post something that makes you a few bucks, possibly over $250,000 if you're lucky. With Apple you get a nicely laid out marketplace that you know people are looking at now. That's what business is about. Taking risk and hoping they work out in the end.
thezonie said 9:59PM on 9-25-2008
Hell, I'm still waiting to be allowed to pay my $99 to get the CHANCE to have my apps rejected.
Any idea at what rate they're letting in new developers? Anyone? Apple?
Patrick said 8:17PM on 9-25-2008
Any tips on finding these underground mailing lists and IRC rooms? I've been trying, but no luck so far...
Reply
sonicwind said 8:05PM on 9-25-2008
You're going to need more than a smattering of C as a base. Objective C, is C++ plus some more stuff. If you already know C++ you can learn the basics of Objective C in a weekend. If not, you can learn the basics of C++ in about 3 months if you're diligent.
Reply
Laurent Boileau said 8:17PM on 9-25-2008
How about a good experience of Java and its swing libraries for GUI issues? Could that warrant as a good programing experience to begin developing Cocoa and Cocoa Touch apps.
sonicwind said 8:39PM on 9-25-2008
re: Laurent Boileau said...
How about a good experience of Java...
Yes, that will help. It sounded like the OP didn't really have GUI experience other than web, which would be another hurdle, although web application development is really more complicated than fat client development. It's different, though. If you're just developing pretty straight forward business apps you can do a lot with basic C knowledge, spending a few hours learning the Objective C syntax and then looking through the many sample applications source code Apple has for download.
Chad said 9:56PM on 9-25-2008
I gotta disagree there, objective-c has little in common with c++ other than both being object oriented. Also, I'd disagree with the main post too, I don't think much c experience really helps much with objective-c. Yes, Objective-C is C with some extras, but in the cocoa world you use those extras almost exclusively and base C almost nil (get it, nil! haha). Of course that's not the rule, some things like sqlite may require straight C (although there are many nice objective-c wrappers around this).
Also keep in mind, most cocoa programming is about the api's more than the language. And Objective-C is different than most other OO languages. Really about the only thing I can think of that would really give you experience in objective-c is smalltalk, and not many people know that.
But besides that, objective-c is fairly easy to learn and use. And despite apple's fondness of verbosity in method naming conventions, it's a pretty easy framework to get started with. View a few tutorials online, check out some of apple's sample code and have a go. Also make sure to read up on Objective-C 2.0, especially garbage collection and properties. Turn on garbage collection and ignore anything tutorials mention about retain and release, it's very confusing to new developers.
And last comment, the iPhone API's, while nice, aren't as well documented as Cocoa IMO. Sample code is helpful but I find it harder to find info on iphone sdk that straight cocoa, the organization on the dev site is just not as good.
Stan said 9:59PM on 9-25-2008
The only thing Objective-C has in common with C++ is C. Many would say you're better off not knowing C++ at all. From an OO perspective, you're much better off cutting your teeth on Java or C#, if not Smalltalk or Objective-C itself.
Glenn Rempe said 10:09PM on 9-25-2008
@sonicwind
Actually, Objective-C is not related to C++, but rather is a superset of C. So you need to know C, and Objective-C to get started.
To quote wikipedia on the subject:
"Objective-C is a very thin layer on top of C. Objective-C is a strict superset of C. That is, it is possible to compile any C program with an Objective-C compiler. Objective-C derives its syntax from both C and Smalltalk. Most of the syntax (including preprocessing, expressions, function declarations, and function calls) is inherited from C, while the syntax for object-oriented features was created to enable Smalltalk-style messaging."
http://en.wikipedia.org/wiki/Objective-C
Apple provides an excellent reference titled "The Objective-C 2.0 Programming Language" which can be found at:
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Introduction/chapter_1_section_1.html