Developing for the iPhone – what you need to know

Many IT companies say the future is mobile. This is not going to be true till the data rates become affordable, but perhaps the large touch screen of the iPhone is a taste of things to come.

Its quite excited to learn about developing for this new platform and see what we can create. Will we be able to use my existing web development and programming skills, or will we need to learn a new set of skills. This is what we’ve learnt so far about what we’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 pros and cons 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, 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.

Using an iPod touch we can 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, we’ve discovered that we 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 we 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. We’ve also read in forums that the Developer Program is so popular that Apple are putting everyone on a waiting list. We thought we’d wait till we created a program worth sharing before I joined the program. There’s a lot to learn before we 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 reccommended 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.

2 responses to “Developing for the iPhone – what you need to know

  1. really good information.objective c knowledge is mandatary for iphone developing?i know c and c++.

  2. great direction. I think you have to try with ruby on rails for development, it’s easy to development
    iphone app development

Leave a comment