Apple Introduces Solution for “Cleaned” App Data in iOS 5.0.1



Apple added a subtle solution for developers in iOS 5.0.1 that addresses the issue of purged app data. In iOS 5.0, apps were suddenly restricted from caching large amounts of data in-app for offline access. Apps were effectively “cleaned” of temporary data when iOS 5 determined that the app was taking up too much space.

Previously, iOS would allow an app to store needed information, such as saved web articles for a news app, in a temporary cache that wouldn’t slow down iTunes backups, restores, and syncs. When Apple introduced iCloud, the company became more aggressive about not allowing apps to temporarily store too much information in-app.

In the recently released iOS 5.0.1 beta 1 and beta 2, Apple has provided developers with a new way to “specify files that should remain on device, even in low storage situations.”

Marco Arment, creator of Instapaper, explains the situation prior to iOS 5.0.1:

“Instapaper has stored its downloaded articles in Caches for years, since I didn’t want to slow down iTunes syncing for my customers or enlarge their backups unnecessarily, and full restores don’t happen often enough for it to be a problem for most people. This new policy now locks me into using Caches: I no longer have a choice.

But in iOS 5, there’s an important change: Caches and tmp — the only two directories that aren’t backed up — are “cleaned” out when the device is low on space.”

A real world example of the policy:

“A common scenario: an Instapaper customer is stocking up an iPad for a long flight. She syncs a bunch of movies and podcasts, downloads some magazines, and buys a few new games, leaving very little free space. Right before boarding, she remembers to download the newest issue of The Economist. (I think highly of my customers.) This causes free space to fall below the threshold that triggers the cleaner, which — in the background, unbeknownst to her — deletes everything that was saved in Instapaper. Later in the flight, with no internet connectivity, she goes to launch Instapaper and finds it completely empty.”

While we’ll have to wait to see how the new method Apple implemented in 5.0.1 plays out for developers, we can only hope that Apple has indeed remedied the issue entirely. No one wants their app data mysteriously disappearing.

  • prof_peabody

    This is explained a bit confusingly.  Instapaper has also said for instance that they knew they had no right to store the info they needed in the cache, it was a hack from day one.  

    What Apple is doing is perfectly fine for any data that *should* be in the cache, Instapaper’s problem is that it has been storing data there that explicitly *shouldn’t* have been stored there at all in the first place.  Thus Apple’s solution of providing more definition of what files can be stored locally and where *outside* of the cache.  

  • marioyohanes

    Apple wants developers to do smart caching using CoreData, but it doesn’t mean you can store everything and taking up all the space, i’m sure users doesn’t want this thing to happen. Anyway, beta 2 just came out, this is beta version, anything could change till last minute.

  • Ayoopdog

    I downloaded a tonne of files for my Downloader app, only to find them all gone one day. Damn you Apple, damn you.

  • Paul Steven

    Perhaps you can shed some light on where I should store my app data. My app has an in app purchase that unlocks certain functionality within the app. Therefore I need to store a flag somewhere to record if the functionality is available. This flag needs to be accessible when offline too so I would assume needs to be stored such that it cannot be purged. If the user is online the app can check for the flag and if no flag is found it can call restore in app purchases.

    My app keeps a record of the users progress (it is an educational quiz type game) for the different sessions and displays a graph within the app of the progress over time. If the user installs the app on another of their devices, I would like this other instance to be able to access the progress data. In this case would it be OK to store the data in documents directory and therefore any instance of the app will have access and be able to update the same data set?