2

I have an app that stores documents in iCloud. iOS seems to regularly purge the local copies of the ubiquitous documents, forcing my users to re-download from iCloud. I had assumed this was due to low storage on the devices but I’ve experienced it myself when my device has more than 3GB of free space.

I also see the same behaviour in the Apple Books app. On the other hand in the Apple TV app on the same device, purchased movies I download don’t ever seem to be automatically purged. This has been the case for me since around the launch of iOS 13, but some of my users have complained of the issue on earlier iOS versions.

Is there a flag I’m missing somewhere that would prevent iOS from purging my documents? The biggest these files get is around 5MB.

Edit based on following Warren Burton's link: After reading the document at https://developer.apple.com/icloud/documentation/data-storage/ , I'm wondering if what I'm looking for is the "do not back up" attribute. I'd previously interpreted this as meaning that if a user reinstalled from a backup, all my app's documents would be lost. But if documents are stored in iCloud, I suppose they would still be available in the same way after a backup is restored, so they don't actually need to be in the user's backup? To further add to my confusion, the docs at https://developer.apple.com/documentation/foundation/urlresourcekey/1408756-isexcludedfrombackupkey specifically say not to use this attribute on user documents, so maybe this isn't the right attribute. Can anyone clarify?

SeanR
  • 7,899
  • 6
  • 27
  • 38
  • Why the downvotes? – SeanR Apr 07 '20 at 20:44
  • Tangentially related is preventing cloud backup https://stackoverflow.com/questions/7772767/disable-icloud-sync but I wonder if there’s an xattr you can set ( and isn’t private API ) or a value on com.apple.mobilebackup that would trigger this behaviour. – Warren Burton Apr 08 '20 at 22:10
  • I speak as someone with an iCloud App and there is no way to prevent this. Apple can because they own iCloud but there is no public API to do what you ask. Apple holds the keys. PS our documents are currently stored with the isExcludedFromBackupKey – Daniel Galasko Apr 15 '20 at 14:54
  • Just to update this, I tried isExcludedFromBackupKey but it didn’t help. – SeanR Jul 05 '20 at 01:50

1 Answers1

0

I’ve come to the conclusion that there’s no way to get the behaviour I want by just relying on the iCloud file management itself.

What I’m going to attempt to do is to copy files manually from the ubiquity container to the local documents and work with them there, saving back to the ubiquity container as necessary. It seems a bit inelegant but should get the experience I want.

SeanR
  • 7,899
  • 6
  • 27
  • 38