5

I cache some downloaded information in the NSLibraryDirectory in an App. However after a recent update the users report having problems accessing the previously downloaded content in the Library directory.

Which directories are safe to cache information over new app versions? Is there any Apple documentation on this? I couldn't find any...

thanks a lot, e.

Engin Kurutepe
  • 6,719
  • 3
  • 34
  • 64

2 Answers2

7

from Apple Application Programming Guide:

Files Saved During Application Updates When a user downloads an application update, iTunes installs the update in a new application directory. It then moves the user’s data files from the old installation over to the new application directory before deleting the old installation. Files in the following directories are guaranteed to be preserved during the update process:

<Application_Home>/Documents
<Application_Home>/Library 

Although files in other user directories may also be moved over, you should not rely on them being present after an update.

DevGansta
  • 5,564
  • 2
  • 16
  • 16
Engin Kurutepe
  • 6,719
  • 3
  • 34
  • 64
  • 2
    Thanks for this reference. I've been struggling with similar issues lately and suspected the sandbox root to change. It's now clear to me that I should store references to files using a path relative to the sandbox and not an absolute path. – Claus Broch Nov 25 '11 at 09:53
  • Beware that symbolic links need to be relinked as well. – markshiz Feb 13 '12 at 19:54
  • @markshiz I am facing problem with symbolic links upon app update. I googled it but was not able to find out how to relink them.Please help. – Any Aug 06 '13 at 07:16
2

Note, however, that /Library/Caches is not preserved across updates; it's not even backed up.

JLundell
  • 1,580
  • 11
  • 14