6 min read

Introduction to iPhone

It has been quite some time since Apple launched iPhone mobile and made a big wave across the world. Initially it got introduced in US market and within a year’s time it was available all over the world. Though there are many who use iPhone mobile, I feel it is important to have an introduction to the device in general, its capabilities and what potential it has for programmers to get the full value for the money.

If you have not held an iPhone, I suggest you should do that first. This will motivate you to know more about the device like how Apple implemented it. Some may like the curves, many would like the way it functions, but for me, its sleek, big yet compact form, touch technology and the biggest screen are some of the really cool things.

Development of iPhone Applications

Everyone knows about the “touch technology” of the device, especially the multi-touch which takes care of two fingers touching the screen at the same time at different places. But there is more to iPhone than touch. Other important features are:

  1. Location finding: using GPS it figures out where it is at that point of time in the world
  2. Accelerometer and Orientation: which give it the ability to detect motion in three dimensions
  3. Programmable Vibrator, Camera, address book

Such features make iPhone more than a just a phone. Technically, the iPhone exists in two largely similar versions: the 2007 original release and the 2008 3G release. It is a 4.7- or 4.8-ounce computing device. Each device contains a 620 MHz ARM CPU that has been under clocked to improve battery performance and reduce heat. Both devices include 128 MB of dynamic RAM (DRAM), and from 4 to 16 GB of Flash memory. The primary difference between the two devices centers on the global positioning system (GPS) and networking.

Some technical specifications:

  • iPhone is built on Apple’s OS X, which itself is built on Unix.
  • iPhone has 480 x 320 touch screen
  • Supports a mobile version of Safari browser
  • Supports LAN and WAN networking using Wi-Fi
  • Uses GPS over Wi-Fi

Programming Basics

In 2008, Apple released the iPhone SDK, a developer toolkit that allows programmers to develop iPhone application.

iPhone SDK lets you develop two type of applications— Web development and Native iPhone Application development.

  • Web applications primarily run on a browser using HTML, CSS and some programming language that can generate dynamic content ( Java, ASP, .NET, JSP, Ruby….).
  • Native applications run on iPhone like any other application on the device. They use iPhone software development kit (SDK) released by Apple with the inbuilt frameworks and other frameworks that it support.

Ignoring for a while that web and native applications have vast difference in the way they are build and they look, the fact is, they both can produce similar result and for some users it may not be easy to differentiate between them. Interesting isn’t it?

Later in this article we will discuss about native application development using the tools and programming language iPhone supports.

iPhone SDK uses the Objective-C language, which is an extension to the C language. Like any other mobile, iPhone too has a different programming platform; Windows Mobile (VB.NET/ C#) and Android ( Java) use object-oriented languages and are identical in syntax. However, Objective-C takes a totally different approach. Being different it creates a learning barrier especially for beginners dealing with Mac OS for the first time.

Objective-C as implemented by Apple is built entirely around Objects. It is used throughout the iPhone OS’s frameworks. Windows, views, buttons, sliders and controllers exchange information with each other in the form of events and actions in order to make the program run.

A header file (.h) and a source code (.m) file together represent each object in Objective-C. iPhone OS frameworks provide many standard classes that come with the framework, but sometimes you may have to write your own subclasses. When you do this, you’ll need a new header and source code class together to represent the new subclass in your project.

The iPhone OS is divided in to four layers (Cocoa touch, Media, Core Services, Core OS), as represented in the diagram. Each layer contains variety of frameworks that you can use in your application/program. Initially, you would be dealing with the top layer.

Development of iPhone Applications

  • Cocoa touch – the base framework, that you will deal most of the time. It contains the UI-Kit framework which includes window support, event support and user-interface management.
  • Media – the framework that provide the protocols to deal with audio and video build in iPhone.
  • Core Services – the frameworks used in all applications, data types.
  • Core Operating System – the kernel level software. Dealing with threading, networking, I/O, memory etc…

What you need for iPhone Development

To get started with iPhone programming, you would need the following:

  • An Intel Mac running Mac OS X Leopard v10.5.4 or higher
  • The iPhone SDK for iPhone OS, which you can download from http://developer.apple.com/iphone. The iPhone SDK contains all the tools and utilities you need to develop iPhone applications. In particular, it comes with Xcode 3.1(the development IDE) and the iPhone Simulator that allows you to test your application without needing a real device.

Though, you can test the applications on the simulator, it is a good idea to register yourself on the iPhone developer program with a nominal fee. This registration gets you a secured certificate issued by Apple and can be used to test developed applications on the device itself. Hence, two more things are essential if the application has to be tested on the device

  • iPhone mobile device
  • iPhone develop program registration

If you are serious about taking up iPhone development, I suggest that you to go for the registration process first before anything else. The registration process in itself is free, but to get the certificate you may have to pay a nominal fee ($100 for individuals). All this process could take up quite some time and meanwhile, you can gear up with all the skills and know-how to proceed with the first application. For more information, see “Accessing the iPhone Developer Program Portal.”

The best way to learn iPhone programming is to get your hands dirty and start coding.

To start coding, you’ll need iPhone SDK and XCode IDE that comes along with the SDK. Assuming, you are already done with the installation, you can find XCode application icon in the /developer/applications folder.

Before starting with the application, take a second and think what you would like to name the first application, I will call it “FirstApp”. This point is important to keep in mind as the name of the application, subsequent to installation on device, appears on the home screen. The purpose of the application could be anything, but what you want to call it and what you want it to appear as on the home screen starts by naming the application.


Subscribe to the weekly Packt Hub newsletter. We'll send you this year's Skill Up Developer Skills Report.

* indicates required

LEAVE A REPLY

Please enter your comment!
Please enter your name here