A programatic challenge to apps in iOS 5
In this week's episode of the podcast
Build and Analyze (iTunes podcast link
here; subscribe or get episode 45 manually), Marco Ament notes an interesting dilemma WRT app data storage on iOS 5. That segment starts at 58:00 of the podcast. Note: when Marco talks about "4.0" he is referring to the 4.0 release of his product
Instapaper. Here's a brief summary of the dilemma:
- The main two places to store files are the app-specific document directory and the caches directory.
- Pre-iOS 5, files stored in the documents directory were backed up in iTunes. App developers (including Instapaper) refrained from putting files in the document directory to keep from slowing down backups. Instead, they'd put them in the caches directory, which was never really treated by devs like a tmp directory. In iOS4 and earlier, the caches directory was never ever purged. It became a place to put files that never really needed to be backed up.
- With iOS 5, things have changed. The documents directory is expected to be backed up to the cloud. (Marco notes that only documents flagged by the app will actually be backed up, and he is doing none of that in Instapaper.) OTOH, in iOS5, the caches directories can be purged. When the device is low on disk space, caches are on the list of places to find files to delete; cache directories are no longer a safe place for developers to leave data files. That's a problem for apps like Instapaper that store their data in the cache directories.
- The obvious solution seems to be to put the data back in to the documents directory. Unfortunately, since that dir is intended to be sync-ready, Apple has started rejecting apps that put too much data in the documents directory. According to the Apple directive, "Anything that can be regenerated or re-downloaded by the app cannot go in the documents directory." Apple directs that such data should be put into the volatile caches directories.
- For Instapaper, that is a bit of a problem: the guidelines don't seem to anticipate apps that download files for offline viewing.
As Marco reports the problem, Apple didn't seem to anticipate the class of apps whose very functionality requires that large amounts of data be available for offline viewing. All of the aviation apps that include flight charts would seemingly have exact same dilemma. A reader might be a bit unhappy if his Instapaper reading material got flushed, but a pilot would be mighty unhappy to find his charts missing at 30,000 feet.
Marco believes that data in the app-specific document directory is only synced to the cloud if the programmer flags that that they be synchronized. In other words, Instapaper would never ever tax the services of Apple's cloud server. With his app, data should make a one-way trip from the Instapaper servers to the device; users would delete files they no longer wanted.
For flight charts, the charts should make a one-way trip from the chart vendor to the device. Obsolete charts would be deleted by the updating program. There is no value in storing a copy of the charts in Apple's iCloud servers.
Apple seems to be missing the target: they don't want to stop programs from storing important data on the device; they need to be minimizing extraneous use of the cloud for backing up data that needs no backup.
This is a fascinating story from Marco's podcast (Thanks!). From my understanding, no pilots should be using their iPads as a
mission-critical device for navigation. On the other hand, there appears to be a disconnect between Apple's iOS 5 storage specs and applications that must be able to store a large amount of offline data. This is one of the large potential pitfalls for using a general-purpose device in applications for which it was never designed. It is not an insurmountable problem, but I hope that the vendors of flight charts for iPads have already been in communication with Apple about this problem.
There's a second question: should pilots dedicate an iPad solely for aviation uses, or should they feel comfortable using the same device for everyday applications, too? I'm wondering how the commercial carriers are dealing with that question, and I'm curious if the vendors of aviation software advise private pilots about other uses.
Update: Users that don't update to iOS 5 immediately may also see impact from this change. If developers have moved data from the caches directory to the app's document directory, then all of that data will get backed up to their PCs when they do backups with iTunes.