
Each iOS application has a working folder for storing files. All items from there, except for the contents of
Caches
and
tmp
, are synchronized with the backup while connecting to iTunes.
Before the release of iOS 5, the system never deleted the contents of
Caches
and
tmp
, they were the only safe place to store data that should always be available and at the same time that can be re-downloaded in case of loss. Thus, this data did not take up space in backups and did not slow down synchronization.
In iOS 5, after iCloud backups have appeared, Apple has begun a battle with apps that store too much data in any synchronized folder, such as
Documents
. Many developers have already received letters from Apple like this:
')
During the last test, it was discovered that [your application] stores a significant amount of data in the Documents folder.
Since iCloud backups are performed daily via Wi-Fi for each iOS device, it is important to ensure maximum user convenience and minimize the amount of data stored by your application.
In addition to the purchased music, applications, books, photos and device settings, all the contents of the working folder of your application, including the Documents folder, are synchronized with iCloud.
The program itself, as well as the Caches and temp folders are not synchronized with iCloud. Your application must store data in specified locations, in accordance with the rules for using iCloud storage .
Please review the specified documentation, make the necessary changes and update the version of the program in the App Store.
The documentation explains everything very clearly:
- Only documents and other data created by the user or that cannot be recreated by your application should be stored in the
<Application_Home>/Documents
folder and will be automatically synchronized with iCloud. - Data that can be re-downloaded or recreated by the application should be stored in the
<Application_Home>/Library/Caches
. For example, these are database cache files or downloadable content, such as what is used by applications for reading magazines, newspapers and mapping applications.
It sounds simple: move everything you can re-download in
Caches
.
Instapaper has long been keeping downloaded articles in the
Caches
folder, because I didn’t want to slow down users' syncing with iTunes and increase backups unnecessarily, and a complete database update didn’t happen so often to be a problem for most people. New rules force me to use
Caches
: I no longer have a choice.
But in iOS 5 there is another important change:
Caches
and
tmp
- the only two places that are not included in the backup - are cleaned when the device runs out of memory.
Many developers have reported this problem with Instapaper even before iOS 5 became available to the general public, so I am horrified to imagine how many complaints there will be when mass sales of devices with iOS 5 begin.
Now there is no place left where to store files that are not needed to be backed up (or even forbidden to be backed up, according to the new rules), but which cannot be deleted at an arbitrary time. This is a problem for many applications, these are the ones that immediately come to mind:
- Instapaper and other programs that save web articles for offline reading.
- Applications for reading electronic books (including iBooks, if the rules apply to it)
- Podcast clients (except for those podcasts that sync with iTunes)
- Offline Wikipedia
- Offline mapping software
The keyword is
offline . You can say that there is no big problem here, because you can download everything again from the Internet at any time. But this is not the case.
A typical scenario: Instapaper user fills his iPad with content for a long journey. It synchronizes a pack of movies and podcasts, downloads several magazines and buys a couple of new games, so that as a result, there is almost no free space on the device. Right before boarding the plane, she remembers that you need to download the latest issue of
The Economist magazine (I have a high opinion of my users). Because of this, the amount of free space falls below the critical point and a trigger is triggered, which runs the cleaning program in the background. Unnoticed by the user, everything that she saved in Instapaper is erased. Later during the flight, where there is no access to the Internet, she launches Instapaper and finds the program pristine.
(Last week, almost exactly such a case occurred with one of my users).
Because of this, everyone suffers:
- She has nothing to read (she just read The Economist )
- My program looks guilty, as if I deleted all the files, because of which the user loses trust in the program. If I'm lucky, she will write to tech support and I will have a chance to explain the true state of affairs. But, most likely, it will either be quietly disappointed, or put one star in the ratings on the App Store, telling everyone what my program is unreliable and deletes all files without warning. Because of this, my sales will decrease (at the same time, Apple’s revenue, which receives 30% of these sales, will decrease).
- The girl has a negative experience with the iPad, the tablet seems less reliable, which is bad for Apple and iOS itself.
Everything gets worse if you think how often access to the Internet is difficult or impossible:
- Devices that are offline most of the day, like the iPod Touch and Wi-Fi iPad
- 3G devices in international roaming
- Any devices that operate on a network with high data rates or low monthly limits (typical scenario outside the US)
- Devices in remote areas, where even the best "broadband" access works terribly and it is impossible to quickly download a couple of hundred megabytes
- Devices that leave the Wi-Fi zone in a few minutes, and then the owner realizes that his content has been removed, but he is late for work, or his children are caught up in rain on a football field, or the dog can no longer tolerate - in general, you need run away now
Even if you always have a fast and reliable connection to the Internet, the sudden removal of data in the application in any case presents a problem.
When a user saves an article to Instapaper, downloads a book to iBooks or a podcast to Instacast, he expects the content to be available the next time the program is launched. Even if it is technically possible to re-download, the person views this content as
his files - he personally put them here and he decides when and whether to delete them.
When the cleaning program erases everything, it looks like the application has deleted its data. And the user doesn’t even know that this is a feature of iOS 5 - he logically blames application developers. Although it is not our fault, it will definitely become our problem.
Obviously, there must be a place to store files, like
Caches
before iOS 5: without backup on iTunes or iCloud, without synchronization. There, the files will be intact until the program itself is removed from the device.
The author of the text is Marco Arment, the author of the program Instapaper.