Getting started

So, how do you get into iPhone development then?

Well, the first step is to get a Mac, as the development kit is only available for Mac. I’d never owned a Mac, so that’s another new thing for me. Which is good.

So, I went off to the Apple Store in my local mega-mall (MeadowHell as it’s known around here) and bought a nice shiny white MacBook from one of the achingly keen people there. I’d only been in the Apple Store once before, to buy a power convertor for my iPod Touch so that it would charge in the car (thanks to Apple changing the voltage that newer iPods work on, something to do with USB versus Firewire, in other words 5v instead of 12v, guess what voltage car stereos work on), and for some reason the people there remind me of the Stepford Wives. Perhaps I just need to be assimilated…

The second thing I did was to buy a book.  After some intensive browsing in the bookshop I decided on “Beginning iPhone 3 Development” by Dave Mark and Jeff LaMarche, published by Apress. It seems fairly readable, full of worked examples, and has a website with a forum to go with it.

So I get home with my MacBook, switch it on, and first impressions are good – it powered up fast, found my home wifi, asked me for the WEP key, and that was it, all sorted. Everything looks nice, and once I got the hang of the new multi-touch track pad I was away.

So first task, download the iPhone SDK (software development kit). This is available free on Apple’s website, though you have to register. Although the development kit is free, if you want to actually run apps on your iPod/iPhone (or publish apps via the App Store) you have to pay $99 for an individual or $299 for a company. I left that step out for now, as you can run your code on the simulator which runs on the Mac and is part of the development kit.

The development kit consists of the following:

  • Xcode
  • Interface Builder
  • iPhone simulator

Xcode is the place where you build your code, and Interface Builder allows you to build the GUI to go with it. They’re nicely interlinked, Interface Builder automatically picking up on the parts of your code relating to GUI elements and allowing you to put things together quickly. iPhone simulator allows you to run your code and see the results on a simulated iPhone on your Mac, so you don’t need to port the code to your own iPhone until it all seems to be working properly in the simulator.

The next thing to note is that the language used is Objective-C. This is an extension to C, adding object-oriented concepts. The object oriented syntax is based on the Smalltalk language, and looked pretty odd to me, despite having done a little Smalltalk programming at university. The other object-oriented C like language I’ve had exposure to before is C++, and the syntax is quite different, though the concepts are the same. There are a lot of square brackets involved!

The other initial thing to note is that there is something called Cocoa Touch. This is the API for the operating system used on the iPhone / iPod Touch, and is similar to Cocoa on Mac OSX, or I guess .net or MFC in Windows. It’s basically an API in the form of a bunch of classes (in Objective C) that your programs will make use of to interact with the iPhone.

So, looks like there’ll be plenty to learn…!

Hello World!

I recently decided to teach myself how to write iPhone apps, and this blog is all about that. I’ve worked in the software business for years, but despite starting out as a software engineer, for the last umpteen years I’ve mostly been a technical writer and so my programming has been limited to short example programs, scanning the source code for information needed in the manuals that the developers didn’t think to tell me, and so on. Oh and the odd perl script to automate various technical authoring tasks. Boring stuff, in other words.

Back when I was paid to write software it was mostly C on Unix (or Borland C on PC), and most of what I wrote was either systems stuff or computer graphics stuff, so I’ve not too much experience of implementing GUIs in modern development environments. Of course, these days what employers seem to be looking for is C# or C++ which mostly seems to mean knowing MS Visual Studio backwards. I’ve never really got to grips with Visual Studio, so wanted to do something more, well… fun.

So, the idea struck me that learning how to write iPhone apps would be a good, and more importantly fun, way to get back into developing software. There seems to be a lot of relatively simple software for sale or free download in Apple’s App Store, in a way it reminds me of the home computer thing in the 1980s. I don’t expect to become a millionaire from writing a hit app (most of the obvious ideas have probably already been done) but it also occurs to me that there’s a lot of scope for mobile front ends for a lot of software, as these devices (iPhone, Blackberry, etc.) are pretty commonplace nowadays. And again, the iPhone seems the most fun (sorry Blackberry fans…). I’ve even seen proper job adverts asking for iPhone developers. So it seems a good bet.