May 8th, 2009

So, you want to start iPhone development

The iPhone is a compelling platform … it has features that other phones don’t have, or don’t do well, it has a huge and rabid fanbase, and it has a single (legal) path for distribution of software with a good e-commerce story. It’s hard to pass it up. So, you want to jump on it, and don’t know how to get started. Well, I want to be the first to welcome you to the cult of iPhone. Once you join the cult, it’ll be hard to leave. Even if you, like me, have actively avoided Apple for many years.The first thing you need to do is decide how you want to tackle your first iPhone app. Are you an experienced web developer with some good CSS and Javascript chops, don’t own a Mac, and just want to get something out there and visible? You can write web applications that feel (largely) like a native iPhone app. There are some shortcomings (not all device features are available, no built-in e-commerce from Apple, user must always be connected, etc), but it might be a good first step for you. (Check out the Apple Web App Gallery for examples of what can be done using the web.) Are you a developer used to writing curly-brace languages (C/C++/C#/Java/etc) wanting to take full advantage of the platform? Or, are you not a developer at all, and this will be your first attempt at programming? Maybe somewhere in between? Native apps are definitely where the fun is at, but unless you already know the Mac environment and Objective-C (the language used to program on the Mac and iPhone), you’ve got some learning to do.

Three Things You’ll Need

Regardless of whether choose Native or Web:

Join the Apple Developer Connection (ADC). This gives you access to Apple’s SDK, and a TON of information you’ll need to get started, including tutorials on Objective-C. You don’t have to apply to the iPhone developer program yet (it costs about $100), but you’ll need to do that before you can deploy any native apps through the app store.

Get a web hosting company. Even native app developers need this, because Apple wants you to have a web presence for support of your applications. Hosting companies abound… you probably already have one. But, check out Dreamhost. Realize that when you start out, you will have zero traffic. Therefore, you don’t want to pay a ton of money. But, you want to be wildly successful, drawing millions of iPhone/iPod owners to your site several times a day to use whatever you wrote. You still don’t want to pay a ton of money. So, you want a company that will allow you to grow exponentially without breaking the bank, preferably without changing the price at all. This is why I chose Dreamhost for my own hosting. I have unlimited disk space, unlimited bandwidth, and all kinds of other goodies, for no upcharges. Seriously, it’s a fantastic deal.

Get a device to test on. You might even want two: an iPhone and an . They have different capabilities and it’s good to know your app “degrades gracefully” to run on the iPod. To install your app on the device, you need to join the iPhone Developer Program, which costs money, so you might hold off on this one if you’re on a budget.

I guess there’s a 4th thing you need: great googling skills. You’re going to have a LOT of questions. LetsTalkiPhone.com aim to help you answer what we can, but you’ll still spend a lot of time with Google.

Web Applications

Let’s get web apps out of the way first. I won’t spend much, if any, time on them here because I left the web world a long time ago, and I’m focusing on native apps for my own enjoyment.

Web apps have a lower barrier to entry than native apps, because really all you need are a web server and a text editor. With those two things, you can make the magic happen. It’ll be helpful if your text edit does syntax coloring based on file type, auto-launches your browser for previews, and other handy things. I stopped doing web development on Windows a long time ago, but back when I did, I used TextPad almost exclusively. But that was years ago, and the world may have changed. Google will help you find something good.

If you’re on the Mac, you need Coda. Period. I am in love with this program for handling the small amounts of web development I need to do. It’s a syntax-coloring text editor with auto-preview, it pushes your changes to your web server, manages source control through SVN, and a lot more. It’s worth much more than its $99 price tag. (No, I’m not a shill for the company, I just love the product!) You can also check out Dashcode, Apple’s development tool for web applications. I only played with it a little, so I can’t speak to how well it works.

Beyond the editor, you need some good CSS libraries. Check out iui or one of the other on the Google Code site. If you decide to use iui as your framework, will be helpful.

Native Applications

This is where the fun is. But, as I said, there’s also a higher barrier to entry. You must have an Intel-based Mac. There’s no getting around this. And don’t skimp! I did. I bought a , as a way to stick my toe in the water. And, I immediately regretted it. After about a month, I bought a and maxed it out on memory. Now I’m much happier. And the Mini gets no love, it just sits in the corner, headless, and handles occasional backup duties.

Assuming you’ve joined the ADC and downloaded the SDK, you need to learn Objective-C and get familiar with XCode, Apple’s development environment. Are you new to that environment? If you’re a brand new Mac owner, never written anything Apple before, take my advice: forget about the iPhone for a little while. Read , which will have you write some Mac-based programs as a way to learn XCode and Objective-C. It seems like a detour, but if you do this, it will make a HUGE difference in your ability to pick up iPhone development. Trust me.

When you’re ready to start doing your iPhone apps, I’ve got another semi-unorthodox recommendation for you: hand-code everything. As of this writing, we’re on iPhone SDK 2.2, and they still don’t quite have the link between the phone and Interface Builder (the tool for visual layout of your UI) right. Things will be strange. And, there’s a fair amount of “magic” that happens via class names and plist files when Apple generates the code for you. Stuff that you won’t inherently understand when you’re starting out, and it’ll drive you nuts! If you go through Apple’s sample code on the ADC website, you’ll notice that a lot of things are hand-coded, rather than Interface Builder generated. There’s a reason for this.

I’ve got a lot more to say on how to get started, and the small (and sometimes large) gotchas and pitfalls waiting for you. That’s the point of this blog, after all. We’ll start diving into XCode next.

BTW, if you have things you want covered here as part of the learning process, leave comments!