iCloud ubiquity containers not being cleaned up on app delete?

余生颓废 提交于 2019-12-04 00:58:46

After much head pounding, I was able to figured this out. Someone mentioned to me that you are able to see all of your iCloud data for your device if you go to developer.icloud.com and login with your iCloud account. Doing some tests with this, I was able to see that the data on the iCloud server was being deleted immediately when I told it to delete from my device. However, all of the folders and files I had created in my ubiquity container on my device stayed, even if I deleted my app.

My work around was to check when setting up my app for using iCloud for the first time and see if my directories were already in the ubiquity container. If they were, then I manually delete the directories and all of the files in them with the following code:

 [fileManager removeItemAtPath:[[fileManager URLForUbiquityContainerIdentifier:nil] path] error:&error];

This is how iCloud is supposed to to work. Deleting an app on one device doesn't automatically delete the iCloud data. If the app is still installed on other devices that use the same account, they can still use the data.

If you want to clear out iCloud data during testing, go to Settings --> iCloud, drill down to your app, and delete the data.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!