NSUserDefault In release mode, the values are missing

In release mode, the values are missing. I don't know what's wrong with it. If I install the debug version first and then overwrite it with the release build, I can retrieve the values stored in debug mode. But if I uninstall completely and install the release version directly, it's empty

The values stored in NSUserDefaults are kept in a file in the app’s sandbox. If you delete the app, the sandbox is deleted too. There is no expectation that user default values will exist when freshly installing a new app.

Have a look at the NSUserDefaults registerDefaults: method. You may find it useful.

If you delete the app, the [app’s container] is deleted too.

Well, on iOS and its various child platforms. On macOS deleting an app doesn’t delete container.

MOEHsin_Canaan, What platform are you working on? And what do you mean by “uninstall completely”?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

NSUserDefault In release mode, the values are missing
 
 
Q