Thoughts on native vs. web apps for smartphones by Forge Apps co-founder Jeff McFadden
When I got started writing apps for iPhone OS in 2008 I was on a huge JavaScript kick (which hasn't really subsided - JavaScript is amazing) and I had never learned Obj-C. I had just purchased my first iPhone OS device, and 2nd gen iPod Touch, and I wanted to write an app. I didn't want to wait to have it running, either.
I looked around and couldn't find any solutions for writing apps in anything but Obj-C, since Apple had limited all the dev tools (seems quite obvious now). Then it occurred to me that, since I write web apps all day long, why not use those same skills to write an iPhone OS app? The browser seemed more than capable, so why not give it a try?
I searched around and found
PhoneGap, a project that aimed to expose some of the native API calls to JS programs via UIWebViews. It seemed cool enough so I gave it a try. It worked great, and the default XCode project got me moving quickly without any understanding of ObjC or Cocoa APIs.
Everything was great, and I got some apps running quickly, but then some problems started to crop up. My app wasn't running as fast as I wanted, especially on first gen iPhones. Scrolling could be sketchy, and because of the limitations of javascript scrolling in UIWebViews and some fixed positioning issues, I was limited in things like how many stocks the app could have since I couldn't have a scrolling list work.
I kept at it and plugged away, ultimately writing an
entire framework to make writing Native iPhone-esque apps using Javascript (this was before jqtouch was out).
Then some problems arose.
PhoneGap apps started getting rejected from the App Store, as massive problem when you want to provide a bugfix for your users and have no way to get it to them.
Also, more and more of my time was spent trying to emulate iPhone OS native controls and behavior, and less and less time was spent writing actual application code.
It was all going backwards. Didn't I choose JavaScript because I wanted to write apps faster?
Then I found the Standford iPhone course. I watched all the courses online and started playing around, writing a few throw-away apps for myself to get used to it.
Then I got busy and took a break from iPhone apps for a while, focusing on some other work.
Finally, earlier this year I picked up the XCode again and got to work writing Inside Trader 3 in native code, from the ground up. I learned about Cocoa, Core Data, and all the ins and outs of Objective-C. After banging my head against the wall for a while, I finally started to grok it, and once I did, it was very smooth sailing.
No longer do I have to worry about native controls, native behavior, or device dimensions. Don't have to worry about fixed positioning, rebuilding scrolling, or 1px css madness. I can quit worrying about the framework and get back to writing actual application code.
PhoneGap still has its place. Not every app needs to be native, especially when you're just trying to wrap an existing web application. Also, PhoneGap has come a long way since I used it.
That said, it's worth the time to learn Objective-C if you're going to be writing apps for iPhone OS. The native APIs provide ease, future enhancement for free, and they take away the pain of trying to write 2 applications at once - the fake UI and then the application logic on top of that.
You've just gotta learn to love the brackets.