Developing for the iPhone - what you need to know

Picture of iPod touch with tools

They say the future is mobile. (Ed. Two years on since originally writing this post, it almost seems like the future is here. We might have all missed the App Store gold rush, but app development for mobile is still exciting and now there's Android, Windows Phone 7 and iPads to think about.)

So, I'm quite excited to learn about developing for this new platform and see what I can create. Will I be able to use my existing web development and programming skills, or will I need to learn a new set of skills. This is what I've learnt so far about what I'll need to know.

There are two options when developing for the iPhone (or iPod touch): Develop a web application or develop a native iPhone application. There are plusses and minuses for both, and both require a completely different set of skills. Until recently you could only develop web applications, but Apple has recently released a beta of the iPhone SDK building up towards the planned opening of the iPhone App Store.

Developing a web based iPhone application

If you're a web developer like me, then this is going to be the easiest and possibly best option. You can use your existing web development skills and you can host your application on your current server.

I bought myself an iPod touch using the excuse that it would help me test websites on the iPhone. They're the same except the iPod touch doesn't have all the applications the iPhone does (most notably, and understandably the phone application). However, I've discovered that you don't even need an iPod touch. The iPhone Software Development Kit (SDK) includes an iPhone simulator. You will need a Mac though to run the SDK.

If you have an existing web application, it will probably already work on the iPhone, unless it uses Flash or a few other non-supported technologies. There are several things you could do to make it work better on an iPhone, some of these things will be helpful for other mobile devices.

You can add an iPhone, or small screen specific style sheet. This will allow you to lay things out better for the available screen size. You may also wish to take advantage of some Safari and iPhone specific CSS. For example there's CSS support for simple animation and transitions.

You may wish to detect that the browser is on an iPhone and serve them a specialised version. Facebook is an excellent example of this and creates an experience that is very similar to using a native iPhone application.

You can make use of iPhone JavaScript handlers that respond to touch gestures. The touch interface is one of the things that makes the iPhone shine, so it'd be great to take advantage of this in your web apps.

There are also some custom meta tags which allow you to control the screen area and whether the user can zoom. You can also add custom links that will launch other iPhone applications. You can even store data in a client side SQLite database, which is apparently part of the HTML 5 spec.

There's a lot you can do and that just scratches the surface. Using and building upon you existing HTML, CSS and JavaScript knowledge you could make something very exciting.

Now that all sounds great, but there are limitations with an iPhone web app. Firstly it's not going to work when the user is offline, and it's going to be slow when their connection is slow. You're also not going to be able to access all of the features of the device such as its location awareness, orientation awareness or be able to access things like the address book. If you want to make use of all the power and all the features then you're going to have to make a fully native iPhone application.

Developing a native iPhone application

If you've previously developed software for Apple Macs then you're probably going to find you can quite easily turn those skills to iPhone development. If you haven't then there's a lot your going to need to learn. It's aimed at software developers, rather than web developers and the skills needed are very different.

Before you begin there are a few things you will need. You'll need a Mac, you'll need to download the iPhone Software Development Kit (SDK) and it'd help for testing if you had a iPhone or an iPod touch (this last bit isn't essential as there is a simulator).

The SDK includes all the tools you'll need to develop iPhone applications. These tools include an interface designer, a code editor, profiling tools and an iPhone simulator. They're completely free, but there is an option to join the iPhone Developer Program. This costs $99. As far as I can tell, you need to join this if you wish to share your applications with anyone. Otherwise you can only install your programs on one designated test iPhone. I've also read in forums that the Developer Program is so popular that Apple are putting everyone on a waiting list. I thought I'd wait till I created a program worth sharing before I joined the program. There's a lot to learn before I can even think about doing this.

If you've not done Mac development before, the first you'll need to learn is the programming language Objective C. Knowing PHP and JavaScript, probably isn't going to help you that much, although it'd be a start. It's most similar to C and C++, although knowing something like Java, Ruby on Rails, or ASP.NET would also be helpful. Although I've used C++ in the past and currently use ASP.NET, I've found Objective C too different to be able to pick up from code samples. I'm currently reading Apple's reference guide to it and I've been recommended the book Programming in Objective C.

You'll also need a good understanding of object orientated programming. If you've used Ruby on Rails, you'll be pleased to know that they seem to make heavy use of the Model View Controller architecture that Rails is built on.

All the actual fun stuff seems to be contained in the various frameworks that provide the iPhone functions and features that your application can use. I've not had time to explore this fully as learning Objective C has slowed me down a bit. These frameworks seem to be the Foundation Framework, UIKit and the Cocoa Touch Framework. You'll need to understand the basics of these frameworks so you can start making use of the functions they provide.

Once you've got your head round Objective C you can start looking through all the code examples they've got. It's probably a good way to start understanding how all the framework features work.

If you want to find out more, the iPhone Dev Centre has load of videos, reference material and code samples to work through:

DJ Risks said

Thanks for this, it as really helped. I too am a web developer and I'm interested in making a web application on the i-phone. It seems like I have to get a MAC first though!

Todd Baxter said

Thanks for the information. I am really interested in the iphones and Ipads touch features. I have an autistic son, and want to develop apps that will help both him and other children with this condition. Going to go with what you shown me and learn objective C and then worry about how I will afford the Mac and Ipad later.. Thanks for the information.

Alwin Tyanto Ikhsan said

Wow, that was a great article. I am very interested in developing iphone software. but i have some question Is it OK to not joining iphone developing program that will cost me $99? Since I am a college student, i will spend my money wisely. I already learn a lot about C and C++ but i know nothing about Objective C, should i learn that first? thanks a lot

Richard Garside said

@Alwin you can try before you buy. You can download the development kit and use their emulator. You won't be able to test it on a real device though. To test on a real device and to put your app in the app store you will need to pay to join the full programme.

Pranav said

Hey Richard, Nice writeup, thanks for you effort! It was really helpful! I am also a web developer, was looking for a starting point with iPhone apps, and this was a good one! Pranav

QuasiProgrammer said

Thanks Richard for such a "One Stop Shop" for introduction to Iphone development. What do you mean by when you say that "to test on a real device and to share your application, you have to buy that membership"? Can't you test your application on your iphone? Why share? For the purpose of learning to build your first iphone application so that you can have the confidence that you know how to build the application, isn't the basic stuff sufficient: such as a Mac, iphone SDK, frameworks, iphone? One can then advance the skills and then can join the iphone developer's program. What do you think?

Richard Garside said

@QuasiProgrammer you can only test your app using the emulator running on your mac. You can't run it on any phone, even your own, without paying Apple some money. I'd learn using the emulator first though and wait till you have something worth sharing till you pay for membership and test it on an actual phone.

ipdove said

Very nice stuff here, thanks. shame you have to have a MAC. I've been trying to get away from windows for a number of years and run Ubuntu for most stuff, but there always seems to be that one piece of indispensable software that relies on windows. Mind you, what you say about keeping the application server side makes a lot of sense, at least that way your app isn't 'tied' to only the iPhone other 'web' enabled smartphones can use it, downside being of course your data connection.

surafel said

I'm interested on developing iphone apps, but I don't have mac, is there any means that I'm able to develop apps for iphone using my pc?

Richard Garside said

@surafel you need a mac to develop a native iPhone app, but you don't if you want to develop a web based iPhone app.

Alan said

@Richard - that is not true - you can install onto your OWN device, i.e. iTouch, iPad, iPhone etc. as long as you register it with Apple and create a certificate. This can be done by signing up to the developer program with Apple, which you have to do to download the XCode etc. anyway - You do NOT need to join the PAID program. I install happily on both my iTouch and iPhone. Additionally - you can go the route I did, rather than get a Mac you can get a hackintosh :) Bought a Dell mini 10V on e-bay and a copy of Snow Leopard and I am happily developing.

Joey Funderburk said

Hi I'm an apple developer who is in the middle of learning objective-c. I highly recommend you read Apple's iOS Human Interface Guidelines. It has been a huge help for me. Also if you are serious about creating apps for the app store, you will defiantly want to test your app on an iPhone, iPod, and iPad, depending on what platform you have created it for. If you create an advance gaming app like a role playing game (RPG) game then you will defiantly want to test your app on an iPad 2 or iPhone 4 because they have new hardware sensors that will benefit your RPG game app. I also highly recommend watching the WWDC 2011 session videos they are VERY helpful. I recommend learning objective-c before you buy $99 membership fee. This fall when they release the new iOS 5 operating system, you will be able to update your iOS device for free and you will be able to get the iOS 5 SDK free with out the membership. You will however have to have the new Lion OS X operating system which you can get off the App Store for $30 dollars. I highly recommend getting Lion it is really cool.

Thank You for listening, Joey Funderburk

Julia Hutchison said

I am looking to make an app and have the ideas etc but no ICT know how at all! I was wondering whether you knew any one that makes apps for people based on their ideas at a good rate? I know its probably a long shot but would be grateful for any knowledge. Thanks Julia

Richard Garside said

@Julia if you have no ICT knowledge at all I'd be very cautious about starting an app project without trying to educate yourself first.

People are often surprised by how long software projects can take. You need a well specified small project to be able to control costs and it's not something that you should jump into lightly.

So, choose your best idea. Keep it simple and create some paper based prototypes.

You can then use those prototypes to get people's opinions on your idea and to explain it better to others. An opinion of a prototype is not a reliable way to judge how much people will like your app. They're often nicer and more forgiving than they would be of the final thing, so don't get caught up in the hype. It is a good start though.

Then when you're ready try going to a local geeky networking event to meet some developers and talk with them about your ideas.