You can have the cake and eat it too.
You can easily mix web and native app by using UIWebView
instances, e.g. implement performance-sensitive parts in Cocoa/Objective-C code, and insert WebKit views in parts which would be too time-consuming to rewrite as native.
You can even wrap whole web app in native package, if you want App Store distribution — see PhoneGap.
You can also develop pure web app that won't look like it's launched via Safari, if user adds your page to his home screen — see jQTouch.
Drawbacks:
Web apps may not be as fast as native application, although with HTML5 offline support and WebKit-specific extensions like transitions and animations, you can get pretty far. Make sure you use touch events — Safari delays onclick
.
It's hard to make pure web app feel like proper native application. For example mobile WebKit doesn't support position:fixed
needed to replicate top navigation bar, and web views have different scrolling speed than table views. It's fixable, but requires ton of JavaScript.
Advantages:
Rapid development. I really appreciated how useful CSS/HTML is for complex layouts when I had to replicate apps in UIView
s (InterfaceBuilder is OK only for semi-fixed layout).
You're insured against Apple suddenly hating and banning yet-another-thing. If they remove your app from AppStore, you can let users access it via web (Google did this with Voice and Latitude apps).
It's easier to port web apps to Android and others (WinMo, HP Pre, latest BlackBerries, etc.) Apple is number #1, but its mind-share isn't proportional to market share. Others are catching up.
If you choose native
You have to do it Apple's way: Objective-C and Cocoa (you can do parts of application in plain C or C++). There's plenty of tutorials and books on the subject, so I won't repeat them here. Just some random bits of advice:
plists, despite being "native" iPhone format, aren't the best for client-server communication. XML plists have high overhead even by XML standards, and binary plists might be pain to generate and debug. JSON is actually faster and usually easier to work with.
If you fetch only small bits of information, NSConnection
only complicates things. You can simply use [NSData dataWithContentsOfURL:]
in method launched via performSelectorInBackground:
.
Notifications are not delivered while UITableView
is scrolling. If you want lazily-loaded pictures in your table, load and set them using callbacks.