Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does iPad clear library/caches?

Tags:

ios

ipad

In response to Apple's changes in iOS data storage guidelines I recently reconfigured an iPad app to store its documents (50MB+) in the library/caches folder.

During testing in the iOS simulator I didn't see any problems with this cache when I simulated an update (following Brad Larsson's suggestion). I also tried deleting all of the contents of the library/caches folder to make sure that my app could recover.

However, when I released the app upgrade I found that my users complained of problems that were traced back to the iPad partially deleting this cache. It seemed like sub-folder structure was at least partially left intact, but sub-folder contents were deleted.

I've redesigned the app to deal with this situation during an upgrade, but I'm worried about what will happen when the iPad decides to clear the library/caches.

Does anyone have any experience or insight into the time when the iPad would try and delete items in this cache?

Thanks

like image 844
Phil John Avatar asked Feb 24 '12 15:02

Phil John


2 Answers

There is no 100% clear answer to this question, because Apples iOS Data Storage Guidelines are very vague … They don't explain in which cases iOS 5 will delete data inside the cache dir …

In most cases iOS starts to kill files when it's getting low on disc space, but sometimes my app lost data for no good reason. So I had do implement some kind of recovery modus to redownload/-generate files the app needs.

This article is interesting: http://iphoneincubator.com/blog/data-management/local-file-storage-in-ios-5

like image 55
dom Avatar answered Sep 21 '22 08:09

dom


The documentation states the following:

On iOS 5.0 and later, the system may delete the Caches directory on rare occasions when the system is very low on disk space. This will never occur while an app is running. However, you should be aware that iTunes restore is not necessarily the only condition under which the Caches directory can be erased.

The part about it never occuring while the app is running is crucial for our app, and is a really good insurance that we won't get unexpected behaviour.

like image 31
ullstrm Avatar answered Sep 19 '22 08:09

ullstrm