It’s been a tough couple of days with my head spinning and – as my wife says – me being not very happy. This is because every book i read about iOS developing appears to be hopelessly out of date. My fault for wanting to get my hands dirty with bleeding edge shenanigans.
Book No. 1 “iPhone Apps for Absolute Beginners” is written really well, however 9 out of 10 examples don’t work. Outdated code, code not reprinted properly, instructions are for Xcode 3, you name it. There’s only so much frustration you can take until you put this to one side and look elsewhere.
Book No. 2 “Teach Yourself iPad Apps” started out a bit tough, but now that I’ve got my head buried deep in this matter sounds more promising by the minute. At least: the examples work, even if they’re based on Xcode 3 too. The author was nice enough to include an updated Xcode 4 chapter on his homepage.
Frustration and agony to one side, let me share with you the exciting things I have managed to build these past few days.
Native Apps in HTML 5 and CSS3
Courtesy of the PhoneGap.com (and Julia’s research) I have managed to discover the magic of Frameworks. These are add-ons of what would natively be possible with Xcode and give you additional ways of getting things done.
In my case, I’m rubbish at Objective-C and have no clue how to even put a message up on the screen, let a lone a picture of video. But thanks to PhoneGap, I can write stuff in HTML – which I’m very accustomed to. Bring it on I say!
Here are a couple of screenshots of my first app using this technology:
I haven’t added CSS here at all hence it doesn’t look pretty. But what does happen is:
- App loads and displays text that I have written
- it also displays my own pictures
- and when you click on it, the NEXT page gets displayed
- all of this without knowing friggin Objective C 😛
The other noteworthy point here is that HTML apps are usually reformatted websites and require an internet connection to work. No good if you’re on the tube. The user doesn’t usually have an icon on the desktop either but instead has to navigate to a URL on the web. Not what we want.
PhoneGap makes all this disappear and gives us the ability to “translate” HTML into an Objective-C wrapper – hence it’s a fully fledged app with access to the iOS device’s cool functions such as camera and phone dialer. It even exports to iOS as well as Android, and they’re planning support for Nintendo 3DS.
To reiterate: write code ONCE in the tools you already know, then deploy to multiple platforms as well as the web. This is huge! Did I mention it’s completely free?
The downside here is that even though you can tweak the CSS to mimic the iOS look, and the fact that you can access core functionality, you’re effectively presenting people with a local website. This isn’t bad, but it limits what you can do with it. The pros greatly outweigh the cons of course, which is why I think the next step is even cooler: