Deleting an iOS App with documents in the iCloud-e

2019-06-02 04:41发布

问题:

I found out that if I delete an App from the device, all local documents are deleted of course, but if the App has files stored in the iCloud-enabled folder ([[[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]) - These files are not deleted.

This causes two problems:

  • The storage taken by these files is not freed.
  • If the user re-installs the App, there are already files in the folder, which disrupts normal initialization.

I can take care of the second issue by going through the directory on first launch and deleting everything in there, but it seems a bit awkward.

I can't think of a way to take care of the first issue.

Any ideas?

回答1:

iOS automatically purges files in the iCloud directory to free up space. You may also specifically "evict" files from your app, but since you are addressing the scenario in which the app is deleted, that probably won't be much help.

See the videos at developer.apple.com/icloud for more info.