TimesToCome Mobile

iOS apps and tips, tricks and tools for smart phones

Beginning iPhone coding, the good, the bad and the ugly




The Basics

It has been painful learning to write programs for the iPhone. My C++ is shamefully rusty and I’ve done everything from a command line for years. So I had to learn ObjC and how to develop code in XCode.

The first thing you must do is sign up for the iPhone Developer Program. There is a free program that will get you the developer kit, manuals, and source code. Pay $99 and you can obtain the certificates that will let you load code onto your phone for testing or put it up on the iTunes store.

Once you’ve signed up you’ll need to download and install the developer kit onto your computer.

If you plan to sell applications on the App store fill out your bank and tax information since it takes a long time for the contract information to get approved. ( iPhone Dev Center -> Program Portal -> Distribution -> App Store -> Learn more -> Go to iTunes Connect -> Contracts, Tax & Banking Information )

The Good

The pdf manuals you’ll find most useful for getting started in ObjC and XCode are:
iPhone OS Programming Guide
ObjC

Then move onto both of these pdfs which walk you through simple projects:
ObjCTutorial.pdf
iPhone101.pdf

Then download all the sample code, you use it often.

(* Note: you must sign up for the developer program to download these manuals and code from Apple. )

The icodeblog has several code examples and it walks you through in very tiny steps.

Another very useful blog with well explained examples and source code is MikeTeo.

Programming in Objective-C (Developer’s Library)‘is a great place to start if you are new to ObjC.

Cocoa(R) Programming for Mac(R) OS X (3rd Edition)‘ is good for learning Cocoa if you know ObjC but it is written for desktop application, not iPhone applications.

If you have written code for cell phones before you’ll find much of the interface stuff is familiar.  It’s just a matter of getting the hang of the Apple drag and drop GUI. You’ll probably want to start with Beginning iPhone Development: Exploring the iPhone SDK if you already know ObJC and Cocoa. I’m only on chapter 11but I can see already it’ll be a well used, well worn book. (Forums for book and the example code for the book )

iPhone Dev Central has forums and video tutorials. I’m not big on video tutorials so I haven’t tried them, but they come highly recommended.

If you want to write games you’ll have to brush up on or learn OpenGL and get the basics of that down. For a really cool example of 3d graphics on the iPhone check out iHologram

If you are totally new to programming you’ll want to download the free pdf or buy Thinking in C++: Introduction to Standard C++, Volume One (2nd Edition) and dig into code get your basic stuff down first.

Also see Miklos Fazekas’s Blog entry on Debugging iPhone provision profiles/certificates. It was a great help to me when I got trapped in certificate hell.

Another place you might get stuck is changing the name of your project in XCode, Me and Mark’s Xcode Tools Tips has some help for that.

Stanford iPhone class is now putting the whole class online not just the slides. I watched the intro lecture and already learned some new tricks.

Learning Cocoa with Objective C ( Online O’Reilly book )

Objective-C 2.0 Essentials ( online book )

Cocoa for Scientists

The Bad

‘iPhone Open Application Development: Write Native Objective-C Applications for the iPhone‘ The ‘iPhone Open Application Development’ book looks to have some interesting information so far I haven’t found a use for any thing in it.

The Ugly

Do not purchase The iPhone Developer’s Cookbook: Building Applications with the iPhone SDK (Developer’s Library) it was a total waste of money and it’s not even large enough to make a good door stop.

When you are debugging and testing applications on your iPhone the gdb runs the existing application if it exists, not the new, leading to some embarrassing got-yas. Before testing, delete existing copies of the application from your phone.

There is little to no information or examples using OpenGL on the iPhone so I added a few to get you started.

Other useful things:
How to rotate a UITabBarController