Facing issue of NSUserDefaults data got cleared on update new version from app store. so all data of user got cleared and user have to login again. I was having app in store with version 1.1.3 and then we have uploaded new version to store with version 1.1.4 but when user download app from store their data was cleared from UserDefaults.so this is big issue in update. need to help. is that apple updated any process on update. Question How Apple change version build in device when we update app from app store. is it uninstall old build and install new build ? Or it is install new version on old version ? Should UserDefaults.standard will delete on update ? Updating Provisioning profile from manual to automatically cause issue on UserDefaults.standard Like UserDefaults got cleared and uuid will change ? Do we have anythings that we can identify specific user as uniq user ? What is better solution to store login data into SQLite store or in UserDefaults as model ? Will appreciate for your help. this is very big issue and login again on update will make app user more effect
UserDefaults.standard was cleared and app UUDI is also changed when I update new version from app store
User defaults should not get cleared out during an update. However if a user uninstalls and then reinstalls the app, it is possible the user defaults getting reset.
As for usage: user defaults are a key value store for storing simple settings and similar things. They are not meant to store huge amounts of user data and are not optimized for that. User defaults are not a database. Login data and other sensitive information also doesn't belong into user defaults (or sqlite) as those are not encrypted. This information should go into the user's keychain.
Hello, @indrajit_9925. Were you able to find a reason why did the UserDefaults got cleared in your case? The app I'm working on is having the same problem, data from the user defaults was cleared after an app update and I'm struggling to find a reason why did it happen. Thanks!