Keyvan Nayyeri

Musings of a Ph.D. student in Computer Science

Getting Started with iPhone Development

Photo taken from http://www2.samford.edu/ts/images/stories/mobile/iphone-logo.jpg I know that it’s been quite a long while that I haven’t written anything on this blog and it marks a record in my blogging history. Moving from a country to another and starting a new life specifically as a graduate student has its own difficulties that eat all your time.

However, the good news is that now I have some obligations to blog at least once a week until the end of this semester and it gives me a good chance to return to blogging covering new topics that may not be very related to the .NET world!

For this semester I’ve taken a graduate Software Engineering course with Dr. Macneil Shonle (recently, we’ve been finding many clones of Scott Hanselman!) and as a main part of our duties for this course, we’re supposed to work on a software project as a team.

The software project for this course is something that should run on top of the iPhone/iPod Touch platform and we need to form groups of 4-5 people. We’re supposed to collaborate on this project and deliver it in a timely manner (by the end of the semester) and follow an incremental approach to build a useful application. Besides, we’re supposed to prepare documentation and information about our work individually and specifically blog about our experiences on a regular basis. Surely, this is good news for my blog readers.

Apparently, Dr. Shonle had some goals in mind by defining this task for us:

  • Force students to work as a team and learn about all the team-work concepts
  • Help them learn about new platforms and technologies especially with a funny project for the iPhone platform
  • Contribute something to the community by building new applications.
  • Learning Software Engineering concepts and applying them in a real-world project in action.

Therefore, I’m going to publish some blog posts in the next three months on this blog and cross-post them to our internal Moodle blog to get some points! I try to share my experiences, opinions and the challenges that I face with, so my readers can grasp an understanding of the process of programming with the iPhone/iPod Touch platform.

To be honest, I’m not a big fan of Apple and haven’t used their products that much, and I’m not planning to do that for ages. I know that there are many people who find their products exciting but as a matter of a fact, I see no point in what they do except one thing: improving the user experience. As a technical user, this is not a big deal for me. As I’ll point in a moment, I got some bad impressions from my first experience with Apple product development.

iPhone Operating System

The iPhone Operating System has derived many features from the Mac OS X and of course, has altered many of them or has introduced new features appropriate for a mobile device, so those who have written programs for the Macintosh operating system should have an easier job learning the process of building an application for the iPhone platform.

The iPhone operating system can be considered as a hierarchical multi-level stack of technologies included in a single platform. This consists of four main layers from bottom to top:

  • Core OS
  • Core Services
  • Media
  • Cocoa Touch

Photo taken from http://developer.apple.com/iphone/library/referencelibrary/GettingStarted/URL_iPhone_OS_Overview/index.html#//apple_ref/doc/uid/TP40007592

The first two levels are fundamental layers that provide more basic functionalities and features, services, and interfaces such as APIs to work with files, low-level data types, network sockets, etc. These programming interfaces are mostly provided in C programming language.

The third level, media, provides several APIs to work with graphics, audio, and video, and combines C and Objective-C languages in its interfaces.

Finally, the upper level, Cocoa Touch, which is basically the main layer that programmers deal with is a higher level API provided in Objective-C to let you apply many of the common tasks in your code.

Typically, an iPhone application is written on top of the Cocoa Touch layer but if you can’t find relevant APIs for your work, you may dig deeper and use APIs from the lower layers.

Software Development Technologies

Building an application for the iPhone platform can be done using several approaches. The default approach, as many of you already know, is applying Objective-C and other development tools provided by Apple. This is used by most of the applications written and released on AppStore.

But the other approach that may be familiar to the fellow .NET developers is MonoTouch, a technology released as a part of the Mono project to let .NET developers apply their knowledge in the .NET development to build applications for the iPhone platform. Basically, MonoTouch binds .NET APIs to native APIs that I described above. It also has a good integration with Xcode IDE that I’ll describe later in this post.

My dear friend, Wallace McClure has written a Wrox Blox about this technology that is worthwhile to read for everyone interested in using this technology.

Unfortunately, MonoTouch is a commercial product and despite our interest to use it for our project, the pricing wasn’t fair for our educational purposes so we ended up with the default approach (using Objective-C).

Objective-C

Objective-C is a reflective and Object-Orientated derivation of the C programming language that adds a messaging style to the C language.

Objective-C is mostly known for its wide usage in Apple Mac OS X and iPhone development. If you’re going to develop for Apple products, you definitely need to know this language in a very good level.

Knowing the C programming language and being familiar with the Object-Oriented concepts, you have a straightforward way to learn Objective-C syntax and style of programming.

Apple developer guide has a good introduction to this language that can give you a basic idea of the language.

Development Process

The development process of an application for the iPhone platform is very similar to programming for many other mobile platforms like Windows Mobile or Android, but some legal phases to get permissions from Apple add to its complexity that in my opinion seem to be a very annoying part of development process for iPhone platform.

Following some steps, you need to sign up on Apple website and submit your generated local certificates to get a Provisioning Profile (after getting approved by Apple) to use on your machine.

As an academic project, we have access to Apple University Program and had an easier process to get our profiles approved here. We have received a set of iPod Touch devices from the university to use for this project and test our code.

After having the Provisioning Profile, and registering your devices on the Apple website, you can start building applications using the below-mentioned tools. After building your applications, you can test them on a local emulator, and then you can deploy this application to your device as well.

Here is a simple example that can get you started with the programming style for the iPhone platform.

Development Tools

Another major limitation of development for the iPhone platform is that it mandates you to use a real Mac machine to write your code and deploy them to your devices. So whether you use the default technologies or MonoTouch, you need to run everything on a Mac machine (and you can’t use a Virtual Machine neither).

Having this important requirement, you can use a rich set of development tools provided for the iPhone development. The most common IDE to use for Mac OS X and iPhone development is Xcode.

You can also use the Interface Builder to put a rich set of controls and user interface elements for Cocoa on your application surface.

Here you can see a good description of the main development tools you can use for iPhone development.

16 Comments

Fahrenheit Marketing is your resource for Search Engine Optimization in Austin.


Sheikha
Feb 06, 2010 4:12 PM
#
It is so clear , straightforward and beneficial ..

Thank you for sharing these information ..
wish you good luck in your project..

Mahdi Taghizadeh
Feb 07, 2010 12:31 AM
#
Great!

Will this be a private application just as your semester project or you may publish it to public too?
Pingback from Dew Drop - February 7, 2010 | Alvin Ashcraft's Morning Dew

phenry
Feb 09, 2010 12:51 PM
#

Thank you for the information. I too am a .NET dev looking at iPhone dev. Great overview and links to goto next. I'm looking forward to your next blogs entries!


gOODiDEA.NET
Feb 12, 2010 6:08 PM
#
Happy Chinese New Year .NET IL perversions: throwing and catching strings VsTortoise - a TortoiseSVN

Lily
Feb 14, 2010 9:17 PM
#
Hi--I stumbled on your blog from Google while searching for project ideas for my Operating Systems course (if you've got any inspiring thoughts, let me know). Anyhow, I just have to say, great blog. Great articles, very well written. I was surprised to find you're Irooni + in San Antonio. My dyee joon lives down there! I try to visit often, but I stay away during the summer months. It's hell down there (literally!). :) I will keep current on your articles. Keep them coming!

Keyvan Nayyeri
Feb 15, 2010 4:22 PM
#
Trackback from The Vision of an Educational iPhone Application.

PHenry
Feb 17, 2010 2:20 PM
#

You specifically mentioned "you can't use a virtual machine either." Why is that? Could expand on that please? Why couldn't/wouldn't you be able to use a VM? Thanks.


Keyvan Nayyeri
Feb 17, 2010 2:28 PM
#
@Phenry

It means that you can't build an iPhone application in a VM that is running OS X on Windows or Linux and then deploy it to the device. You need to have a real Mac machine to do that.

Keyvan Nayyeri
Feb 22, 2010 5:10 PM
#
Trackback from Deployment Process of an iPhone Application.

Keyvan Nayyeri
Mar 19, 2010 8:38 AM
#
Trackback from Getting Started with Xcode IDE for iPhone Development.

Keyvan Nayyeri
Apr 08, 2010 10:14 PM
#
Trackback from Functional Specifications of CrunchTime.

Keyvan Nayyeri
Apr 19, 2010 3:13 PM
#
Trackback from An Overview of Objective-C - Part 1.

Keyvan Nayyeri
Apr 30, 2010 10:33 PM
#
Trackback from An Overview of Objective-C - Part 2.

Keyvan Nayyeri
May 03, 2010 12:42 PM
#
Trackback from An Overview of Objective-C - Part 3.

Keyvan Nayyeri
May 06, 2010 10:42 AM
#
Trackback from CrunchTime - Concluding Remarks.

Leave a Comment





Ads Powered by Lake Quincy Media Network