Confused about meaning of NSURLIsExcludedFromBackupKey

I thought I understood that files stored in the Documents directory would never be purged by iOS, in addition to being backed up to iCloud unless marked with the NSURLIsExcludedFromBackupKey. But after re-reading the documentation, I'm confused:

Use the "do not back up" attribute for specifying files that should remain on device, even in low storage situations. Use this attribute with data that can be recreated but needs to persist even in low storage situations for proper functioning of your app or because customers expect it to be available during offline use. This attribute works on marked files regardless of what directory they are in, including the Documents directory. These files will not be purged and will not be included in the user's iCloud or iTunes backup. 

This seems to suggest that iOS WILL purge files from the Documents directory, unless they are marked with the flag, in which case it will also not back them up to iCloud.

I want my files to be BOTH backed up to iCloud AND never purged by iOS. What should I do to get this behavior?

This is a very important issue for me, because I'm spending a lot of time fighting with customers who insist that my app is losing their files even though I can never reproduce the problems in my testing.

Thanks,
Frank

I want my files to be BOTH backed up to iCloud AND never purged by
iOS.

You should:
  1. Put them in Documents.

  2. Don’t set any attributes on them.

The behaviour you want is the default behaviour for everything outside of Caches.

If you specifically don’t want these files in Documents because, for example, your app’s Documents directory is visible to Files, follow the advice from QA1699 Storing Private Data.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thanks. This is in fact what I am doing, and I think it works, but I still get a fairly regular stream of reports from customers with problems that seem to suggest files go missing for unknown reasons. I guess I'll keep looking for another explanation.
Confused about meaning of NSURLIsExcludedFromBackupKey
 
 
Q