Removing an application from a device does not clear NSUserDefaults

I store the value in NSUserDefaults, which I use to check if it was the first time I started the application. I check this value in the App Delegate app and it works fine for the most part. However, I expected that this value would be cleared if I uninstall the application from the device, so that when it first starts after reinstalling it, it will behave as if it had never been installed on this device. However, the value stored in NSUserDefaults still exists. Now I know how to purge NSUserDefaults programmatically, but how would I do it and can still tell if it was the first time I started the application (and was first launched after it was uninstalled as the first run)?

Edit: This problem was for a real physical device (not a simulator). Removing the application from the DID simulator will clear NSUserDefaults correctly. However, yesterday I had an iPhone, and the new phone did not detect this problem. Now NSUserDefaults is correctly cleared. I don’t know what fixed the problem, but I’ll take it.

+4
source share
1 answer

For those who face the same problem on the device.

If you have more than 1 application under the same group, and all of them use application groups (included according to their capabilities), you will have to remove all applications from the device in order to clear user defaults.

, , , .

+6

All Articles