Hello World – How difficult could it be?

Well, it has been a few weeks since the last update. In the intervening time, I have descended deeper into the Apple labyrinth with the procurement of an iPad (with my lovely wife as an accomplice) and shelled out to join the Apple iOS Developer programme (More on that in future posts). However, where we left the story was a bit further back through the sands of time – having secured myself a Mac running Snow Leopard to host my sparkly new development environment….

Apple iOS Software Development Kit
An SDK is a cardboard box with the letters S, D & K on the front.

First things first – I needed to get my mits on the iOS Software Development Kit (SDK) – which, remarkably, is free and includes the Xcode IDE (Integrated Development Environment – the thing you use to write the code). You can get it from here yourself if you don’t believe me: http://developer.apple.com/devcenter/ios/index.action. Of course, before you can get it, you need to register as an Apple developer – ahhh the subtlety as you slip in to the snare…  But once registered, it’s free to download.

Actually, it’s only kind of free. Well, it is and it isn’t. That is to say, it’s free in so far as saying yes to the license terms and conditions. I carefully read them, reviewed the finer points with legal council and submitted a Judicial review in the High Court to get a definitive position on the “forfeiture of soul” clause.

Where it’s not so kind of free is that although you can write and compile code for the iPhone simulator that they so nicely provide as part of the SDK, you can’t actually install the results on an actual iPhone. Not yet anyway. For that you need to buy in to the iOS developer programme (see above). Ah ha! The trap is sprung!

But that’s OK – fair dues – for my first outing, all I wanted to do was to do the obligatory “Hello World” app, compile it up and run it on the simulator. Easy peasy, lemon squeezy.

Somehow, in navigating the Apple developer web site, I managed to sail straight past the “Hello World” app – and landed myself the sample “MoveMe” app. The ironic thing is that in writing this blog update I came across it straight away and had to really look hard for MoveMe. So I took the scenic route the first time – is that a crime or something? It is? Oops. I plead insanity.

A picture of the Xcode GUI
XCode - it's an IDE, but not as we know it.

Anyway – downloaded the sample code and unpacked it in the downloads area of my Mac. I really must put these things in a more sensible place – but hey ho. Fired up Xcode and pointed it at the sample code. Clicked on “Build and Go” – and before I knew what had happened a simulator iPhone pops up and there is the app.

As an app, it’s not all that exciting – a button that flashes the word “Welcome” for a split second flash frame (conspiracy theorists take note). You can then drag the button around the screen and when you let go – it goes boinnnggg back to the centre of the screen.

Hang on a minute – now I come to think of it, there wasn’t very much in the way of actual coding going on there. Not exactly a very fair hello world test, is it? I can hear the mocking voices of the Program Police mock my attempts by mockingly saying things that are mocking. But “Pah!” I say (more in a kind of off hand east coast way rather than the French version which includes a semi shrug) – there may not have been much in the way of coding – but this proves that my development environment works, doesn’t it? Lost for words now, aren’t you, mock cop?

So there we have it – a redefinition of success for the Hello World app … that wasn’t even the hello world app in the first place. Of course the real test of the development environment would be to get the app on to my iPhone. Now that would be clever, that would be a real achievement and that would set me back £59…

Choose your weapon

A multi platform development environment - and available on Windows!

Casting my mind back – I was the proud owner of a glossy new iPhone 4, but had no other Apple devices or experience. So when the mood took me to have a pop at developing an iPhone app, I naturally looked at how I might go about doing so using my Windows 7 PC and a bit of creativity.

I quickly rumbled a delightful development environment called Appcelerator Titanium Mobile. This is a snazzy way to make web applications for the iPhone – so if you are o-fay with JavaScript, HTML, CSS et al. then you can use this to create native looking applications that can be compiled up for both iPhone and Android platforms.

Now if you are not particularly technically minded (and are still reading at this point) – all this means is that you can use the same skills that are used to make whizzy web pages like the one you are looking at. Everyone can do that – even my mum. Well, she could if she got past playing solitaire. Anyway, you might ask what good is that on an iPhone – after all you’ve got a Safari web browser anyway? Well, that is a very good question, thank you for asking. Firstly it gives you a common way to write applications for Apple and non-Apple stuff (like an Android based Google phone) so you only have to write them once. Secondly, if it exposes some of the special features of the devices – like the GPS for instance – so you might be able to do all kinds of clever things. Lastly, there is a Titanium platform that runs under Windows! Result.

I excitedly installed Titanium for windows and fired it up. It became clear very quickly that all was not quite well and that the options to do stuff with iPhones were conspicuous by their absence. Not so much that they had sloped off down the pub for lunch as they had suffered a total existence failure. A bit of digging revealed what needed doing to complete the install was to download the iOS development libraries from Apple. And this was (obvious in hindsight perhaps) slightly inconvenient as I was using Window 7. You see, the iOS development libraries are only available to install (for the iPhone 4) under Snow Leopard. That means I needed a Mac of some sort in order to go any further. It all started off so promising. 🙁

Small, but perfectly formed.

Now getting your hands on a Mac that can run the latest version of stuff can be something of an expensive business. Probably the cheapest entry point to buy from new is to go for a funky little Mac Mini. These will set you back the better part of £800 once you have bought a keyboard, mouse, iPod stand, MobileMe, leather carry case and a strange bit of white plastic which seemed very important in the store, but has no subsequent purpose or meaning.

But why stop there – how about going for the panoramic omni-mega supersize iMac – or the ultimate in portable chic – the MacBook Pro. Regrettably, my bank account doesn’t have a number with four digits in it at the end of the month (two would be nice together or just a positive sign at the front) and I’m not given to melting plastic to satisfy spending splurges. Not really an option for the sake of curiosity. But they are nice. Very nice.

There is always the possibility of going on to ebay to pick up an ultra-cheap nearly new Mac. I don’t know if there is something I do wrong on ebay, but when I’m looking through the auctions, I seem to find lots of nearly new stuff that is at least as expensive as buying it new from a shop – or some older second hand stuff that is still about as expensive as the new – but without a tedious warranty or the baggage of consumer rights. Actually, I did pick up some door handles from ebay once that were quite reasonable. Unfortunately, you can’t install OSX on a door handle.

But there is another way. An all together darker and furtive way. Not a way that your Gran would have approved of – but maybe a way that your Uncle Gary would have had a quiet word with you about afterwards. The legalities are somewhat grey and the characters who promote the approach are even greyer. I speak, in hushed tones, of the Hackintosh. A Hackintosh is a way to install the OSX operating system on a standard PC by modifying the bootloader and device drivers to work with bits you can buy from your local computer tin shifter. Even if you pay for the operating system software, the terms and conditions may preclude you from installing it on anything other than official Apple hardware – although it is interesting that the European Competition Commission are currently investigating IBM for anti-competitive practices because IBM does not license it’s mainframe operating system on anything other than IBM hardware. Hmmmm.

Quite which approach I ended up taking, I will leave to the mysteries of time and space. Suffice to say that I started off with just an iPhone and now I’d also picked up a Mac. And there were even more jolly purchases to make before landing the first app on the phone.

It was fun, but through clenched teeth.

That’s one small step for mac…

The Apple Store in Solihull
Go in for a phone, come out with an addiction

OK, I admit it – Apple stuff is kind of OK. Surprisingly OK actually. For years I have sneered at the one button mouse, sniggered at the £2000+ laptops and lumped the likes of Steve Jobs in to the same bucket as bad boy Bill. But after a flash of light and a brain bobble brought about by fatigue and overdosing on Starbucks coffee standing in a queue to reel in the last 32Gb iPhone on sale at the Apple store in Solihull, I have seen the leopard. He was white, spotty and his name is Phil. 

After spending weeks and weeks getting my iPhone just the way I want it, breaking it, restoring it from backup, fixing the backup, restoring it again from backup, upgrading it, restoring it from backup one more time and finally getting it just the way I want it again, I found myself thinking about the next exciting challenge that I could sink my teeth in to. After I had backed up my phone, of course. 

At work people were asking some important questions. I wasn’t particularly interested in those, but I was interested in other ones about how the pervasive technologies of the iPhone and iPad might make a difference in industry. In the past, the Nokia N95 had brought together a phone, GPS, Wi-Fi, 3G, accelerometer, camera and even (ultimately) the OVI application store. It might not have been the first, but it was the first I owned. I remember the sense of excitement there was with the arrival of the initial batch of super java enabled smartphones. Well, OK, I don’t get out much. But I was excited even if no-one else was and I set about thinking of the dramatic ways in which these devices would change the world to be smarter, more interconnected and enriching for Swedish people. 

Nokia N95
The Nokia N95 - What else could you ever possibly need?

And yet, although the N95 version of Tetris was rather good, there really wasn’t a killer app that shaped the way we do business or changed the lives of the chattering middle classes. Even Swedish people weren’t that overwhelmed by it and so deposited their money instead in safe high interest Icelandic financial instruments. These days, of course, the iPhone and the iPad don’t appear to have much more to offer than the original batch of smartphones – including the original iPhone up to the 3G. 

Except, of course, the latest incarnations do everything just a little bit better. They are just a little bit faster, with a bit of a better screen, with better this and better that and a generous helping of something or the other.  Could the sum of this be more than something “better”? Could this be something that transcends the hype? Could the promise offered to the world by a bunch of Swedes be realised by a gaggle of Californian techno-hippies? Could this be a tipping point? 

Maybe, maybe not – but it interests me enough to chip in and find out for myself. And to this end I set about figuring out how to build apps for the iPhone and iPad – iOS. I’m just at the start of the journey – but was surprised by the level of interest shown in what I was up to. So – I’m going to spend the next couple of posts catching up to where I am – setting up the development environment and installing my first test app on my phone from the iOS tutorial – and then you can tag along for the ride  to see where it goes from there. 

Should be fun.