Saturday, October 16, 2010

Getting started with iPhone development

The iPhone SDK is largely based on Objective-C, a language that achieved some notoriety when Steve Jobs decided to use it in his Next computer in 1988. Objective-C, not coincidentally, is also the main programming language used for Mac OSX. Code is compiled down to native ARM instructions. Compare this to Android, which has a virtual machine that runs portable instructions. The iPhone approach is faster, especially if you’re doing a lot of processing in user code (as opposed to system or graphics libraries). However Android’s is more flexible because it can support processors other than ARM (like Intel’s new Atom CPU) without requiring developers to recompile.
 The iPhone’s operating system is similar to that found in Mac OSX. The kernel is a variant of the same Mach kernel that is found in the Mac. On top of that are layers of services that are used to implement applications. The Core OS and Core Services layers provide fundamental interfaces such as file access, Bonjour services, a SQLite database, network sockets, etc.. These interfaces are mostly C-based.
The Media layer supports 2D drawing (Quartz and Core Animation), 3D drawing (OpenGL ES), audio (Core Audio and OpenAL), and video (H.264/AVC). Most of these are C-based as well, except for Core Animation which is Objective-C.
The starting point for any new project is the Cocoa Touch layer, which mostly uses Objective-C. This layer includes the Foundation framework (object-oriented support for collections, files, and network), the UIKit framework (windows, views, and controls), and other frameworks for contacts, photos, accelerometers, and other hardware features.

With in my next POST, I will include sample code for iPhone Development for various examples.