Deleting iCloud data doesn't clear NSUbiquitousKeyValueStore?

I have an application that is configured to use iCloud. I am adding a key / value to NSUbiquitousKeyValueStore and I can get it, as expected, on all my devices. However, if I delete iCloud data from my application from the settings, I would expect that all iCloud data that I added to NSUbiquitousKeyValueStore will also be deleted, but it is not. I can get all the data no matter how long I want to sync iCloud.

I went to developer.icloud.com and watched how my other iCloud data (I also use Core Data over iCloud) was deleted correctly, but they are not in the folder where NSUbiquitousKeyValueStore stores its data from what I can say.

Does anyone know if this needs to be removed? It is like a “cloud leak” if the user cannot delete it.

+6
source share
3 answers

Here is how I do it:

NSUbiquitousKeyValueStore *kvStore = [NSUbiquitousKeyValueStore defaultStore]; NSDictionary *kvd = [kvStore dictionaryRepresentation]; NSArray *arr = [kvd allKeys]; for (int i=0; i < arr.count; i++){ NSString *key = [arr objectAtIndex:i]; [kvStore removeObjectForKey:key]; } 
+6
source

Deleting iCloud Documents and Data simply deletes any documents and CORE data. It does not delete anything in NSUbiquitousKeyValueStore. I expected him to remove ALL about the application.

Before adding iCloud support, I used NSUserDefaults to store small pieces of data for the application. For example, the end user can enter their name and address, and I would save this in NSUserDefaults. This is not complex data, and I do not need to use the main data or a flat file to store it. It is very easy to store there, and it works. If I remove the application from the phone, this information will disappear, as I expected. When I added iCloud support, I put it in NSUbiquitousKeyValueStore. However, even if I delete the application and then delete the “documents and data”, the name and address of the end user will be STILL there.

I thought I was doing something wrong. After most of the day's research, I found that iCloud keyword storage should be for “discrete” data and that “iCloud key value data storage is not what the user will see.”

Thus, although it is perfectly capable of storing non-complex user data that the end user actually sees, it is not intended to be used. What I am doing "wrong" uses it for misuse, although it works well for that use.

I am not sure why Apple will not remove ALL from iCloud. Or at least give the user an opportunity.

+2
source

It is true that NSUbiquitousKeyValueStore remains after uninstalling the application. At the time of removal, the device does not know whether your other devices will still receive shared data.

You must use it to store the purchase status in the application, user information, etc. that you want to share between devices, and restore if the application was accidentally deleted (or deleted and then reinstalled later).

NSUserDefaults, on the other hand, is data belonging to the application itself on this device, so uninstalling the application should delete the data.

+1
source

All Articles