In my iPhone app I’m caching the raw data of some compressed files to save loading time. But those files may change in an update.
Will iOS clear /Library/Caches for me when the app is updated or I need to clear it myself?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Short:
Will iOS clear /Library/Caches for me when the app is updatedNo
Is it possible that iOS does clear everything or parts of
Application_Home/Library/Cachesduring an update? Yesor I need to clear it myself?You need to ensure what you want to be cleared is cleared.Be prepared for both situations.
How do you know whether your app got updated? See iOS Application Update Test
Long:
From Apples Documentation: The Application Runtime Environment – Backup and Restore
From Apples Documentation: The Application Runtime Environment – The File System (daveoncode)
Here an example of when it does clear the cache during an “update”:
You install app X V1.0. Lunch it once and the start doing something else. iOS malfunctions and needs to be restored. Developer releases V1.1. You update the app in iTunes on your Mac. You restore your device via iTunes. iTunes installs V1.1. User lunches your app. Your app does not get notified that any of that stuff happened but all files in
Application_Home/Library/Cacheare gone (iTunes removes them during a full restoration of the device).Really important information in there:
It should also be able to re-create these files as needed. Like Kendall also pointed out it is a cache, so files could be deleted from it by the operating system at any point. So every time you load any file fromApplication_Home/Library/Cachesyou have to account for the case that the file isn’t there anymore (Kendall touched on this).