Chapter 24: Going Offline

The iPhone can connect to the Internet from nearly anywhere. Most iOS apps use this capability, which makes these apps one of the best Internet-powered devices ever made. However, because it’s constantly on the move, connectivity, reception, or both can be poor. This poses a problem for iOS developers, who need to ensure that their apps’ perceived response time remains more or less constant, as though the complete content were available locally. You do this by caching your data locally. Caching data means saving it temporarily so that it can be accessed faster than making a round trip to the server. That’s easier said than done, and most apps don’t get this right.

This chapter shows you the caching techniques you can use to solve the problem of slow performance caused by poor or unavailable connectivity. In Chapter 14, you found that Internet-connected apps fall into two major categories. The first category of apps behaves like a front end to an online web service. The iHotelApp in Chapter 14 is one such app. In this chapter, you add caching support to the iHotelApp that you developed in Chapter 14. The second category of apps synchronizes user-generated content with a remote server and optionally downloads the most recent “n” items from the server. iOS 5 introduced a new cloud platform specifically targeting the second category of apps. Chapter 25 introduces you to iCloud where you’ll also discover ways to sync users’ data across all their devices ...

Get iOS 6 Programming Pushing the Limits: Advanced Application Development for Apple iPhone, iPad and iPod Touch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.