Does the "do not back up" attribute use the data in the "Library / Caches",

Apple storage rules specify the following:

2) Data that can be reloaded or regenerated must be stored in the / Library / Caches directory.

... and (my attention):

4) Use the Do Not Back Up attribute to specify files that should remain on the device, even in low-storage situations. Use this attribute with data that can be recreated, but it must be preserved even at low levels for your application to work correctly or because clients expect it to be available offline. This attribute works on marked files no matter what directory they are in , including the Documents folder. These files will not be cleaned up and will not be included in the iCloud or iTunes user backup. Because these files use storage space on the device, your application is responsible for periodically monitoring and cleaning these files.

The page referenced by Apple with a more detailed discussion of this section does not mention anything about an attribute that does anything to prevent caching of data from being cleared.

Does anyone know if the “do not back up” attribute really works like “do not back up or delete” for items placed in /Library/Caches , or if the files still need to be stored inside the Documents application to make sure that they are not removed when the device operates in a limited space?

+4
source share
2 answers

I did a quick test on the iPhone 5 iOS 7.1.1:

I put some files in "/ Library / Caches" ( NSCachesDirectory ) and marked them with the NSURLIsExcludedFromBackupKey attribute. Then I put several large files in the same directory in the usual way.

Then I made a warning about running out of disk space by taking a long video with the camera app. After the warning, files marked as “do not back up” were not deleted from the cache, but there were other files! Thus, this attribute really works and does two different things, despite its name - it excludes from backups and saves it from being cleaned when warning about low space.

+4
source

This is very clear to me, and the directory structure is the one I will stick with first, just like Apple. If you both want to save the file and not back it up, put it in Documents, preferably in the folder that you mark.

Even if you observe some behavior today using Caches, it can change in the future.

0
source

Source: https://habr.com/ru/post/1481302/


All Articles