/>
X
Business

Getting started with iPhone development

I've been doing Android development for some time, and before that I experimented with Palm and Blackberry, so I figured it was time for some hands-on iPhone programming as well. In this article I'd like to share a few of my initial experiences.
Written by Ed Burnette, Contributor on
iphone-axes-200.jpg
I've been doing Android development for some time, and before that I experimented with Palm and Blackberry, so I figured it was time for some hands-on iPhone programming as well. In this article I'd like to share a few of my initial experiences.

Apple released the first official iPhone native SDK in March 2008, although there were ways to run native programs unofficially before that. In an earlier article, Apple opens iPhone to developers, I introduced some of the basics of the architecture and tools so you may want to read that first.

Prerequisites

The first thing you need is an iPhone or iPod Touch of course. You can do some early development using the simulator, but there's no substitute for the real thing. Next, you need an Intel-based Apple Mac running OS X version 10.4 or higher.  I recommend at least 2GB of memory and a decent monitor (24-inch works well).

You'll have to sign up for 2 things on the Apple web site:

  1. Become a "Registered iPhone Developer". This is free and it gives you access to download the iPhone development tools including the emulator.
  2. Join the "iPhone Developer Program". This currently costs $99 for individuals or $299 for companies. The big thing this gives you is the cryptographic keys so you can download your code to a real phone.

Finally, you download and install the iPhone software development kit (SDK). It's pretty big, so don't be surprised if it takes a while to load.

Could they make this any harder?

Once you get all of the above in place you load up a sample program into Xcode, plug in your iPhone, and click Build and Go and everything works. The end.

What? That doesn't work? Oh, ok, there are a few other itsy-bitsy things to take care of first. Compared to this, getting started with other platforms is a walk in the park.Actually there are several large and annoying things, mostly centered around those cryptographic keys. If you do it wrong, you'll see an error like this when you run your app:

Your mobile device has encountered an unexpected error (0xE8000001) during the install phase: Verifying application

Thankfully there is a wealth of information on the web to help you past this hurdle, both in Apple's iPhone Reference Library, and in blogs like this excellent article by Ralf Rottmann. You'll need it.

The key (no pun intended) is that you need to download and install at least 3 different cryptographic certificates:

  1. An Apple world-wide developer certificate (WWDR), installed on your Mac,
  2. A personal  developer certificate, also installed on your Mac, and
  3. A mobile provisioning profile, which will be installed on your iPhone. Actually you may need 3 of these, one for local development, one for betas, and one for the AppStore.

Ralf goes through all the steps, including lots of screenshots, so I won't repeat that here. But I did have one problem that Ralf didn't have. After following all the instructions, programs *still* were not installing. A colleague suggested wiping and re-installing the iPhone but I really didn't want to do that. It turns out I had to delete my provisioning profile and re-install that.

From Xcode, go to Window > Organizer, select the iPhone, select the Summary page, and then select the profile in the Provisioning area. Click on the "-" button to delete it. Then click on "+" and add it back again (you'll have to navigate to the .mobileprovision file you downloaded from the Apple web site). If you switch over to the Console tab and click Reload you'll see a message like "downloaded 44484 bytes of firmware data (0x0088.hex") in 69ms" - that's the Mac installing the profile onto your phone. From then on, everything was honky-dory.

Success

Now you should be able to build your sample and run it on the phone. I chose the GLGravity sample, which you can find here if you can get logged in. Just unpack it somewhere and double-click on the .xcode file. It draws a teapot on the screen using OpenGL, then uses the accelerometer to keep the bottom of the teapot pointed towards the ground no matter how you hold the phone.

I have to say that the barrier for getting started with iPhone development was higher than I expected. The Apple Developer Connection site is frustrating, confusing, and on top of that it keeps logging me out every few minutes. Everything is locked down tighter than a drum, and juggling multiple cryptographic keys just complicates everything. Compared to this, getting started with other mobile platforms is a walk in the park. Hopefully it will get easier from this point on.

Editorial standards

Related

The 16 best Cyber Monday deals under $30 still available
Amazon Fire TV Stick 4K

The 16 best Cyber Monday deals under $30 still available

Epson is going to stop selling laser printers. Here's why
piles-of-paper.jpg

Epson is going to stop selling laser printers. Here's why

This cruel email-hacking gang aims to tug on your heartstrings and steal your cash
a-woman-holding-her-bank-card-and-doing-online-shopping-from-home

This cruel email-hacking gang aims to tug on your heartstrings and steal your cash