Facebook Goes iOS Native
Facebook updated its app for iOS devices after customers complained about slow operating speeds.
The core problem, according to Facebook's Jonathan Dann, who wrote a post explaining the change, is that the first priority for the app was scalability; the app was written largely in HTML5 so it would display in any device with a Web browser. He explains:
"We chose to use HTML5 because not only did it let us leverage much of the same code for iOS, Android, and the mobile web, but it also allowed us to iterate on experiences quickly by launching and testing new features without having to release new versions of our apps."
Using HTML5 has solved that issue, and Facebook's 500 million mobile users have access. The next issue, for those on iOS devices, is one of performance. HTML5 speed can't compare to native speed, so Dann said they started from scratch to build the Facebook mobile iOS app in Objective-C: "(I really did open up Xcode and click "New Project")", Dann writes.
Using Objective-C meant re-engineering the entire app, as well. One of the main changes was moving a lot of the work off of the main thread and into the background. The main thread, Dann explained, is responsible for the UI and touch events, so the more work assigned to that thread, the slower the interface and touch responsiveness for users.
A Facebook executive told Mike Isaac of AllThingsD that the company is still using HTML5 for many devices, and is "probably" building an Android-specific app as well. One thing's for sure: the millions of iOS users are glad that Facebook decided to go native.
The lesson for developers is that it's critical to balance the need for device compatibility with the mobile requirement of snappy performance. If it's more important that your app work across a range of devices, or your development team is too small to develop for different platforms like iOS, Android or Windows 8, a platform-agnostic technology like HTML5 may be the ticket.
On the other hand, if you're a game developer or building a GPS app where milliseconds count, for example, native development should be the priority, even if it means building separate versions of the same app. Facebook, of course, is an extreme example of this; chances are that your app won't be running on half a billion devices. Even if it's running on just 10,000, though, that's still a lot of annoyed users who may try out your competitor's app if yours doesn't deliver what they need.
Keith Ward is the editor in chief of Virtualization Review. Follow him on Twitter @VirtReviewKeith.