Post

Replies

Boosts

Views

Activity

Comment on UserDefaults not cleared after Uninstall
Save a parameter isNotFirstInstall in user defaults.standard. Set it to true after you do your 'first install' stuff. If you need this value in the app groups other apps, the main app should make a copy of this value under a different name in the app groups user defaults. When the main app is uninstalled and then installed again, isNotFirstInstall will be nil and then the main app can delete the values in the app groups user defaults since you know all the keys. Let me know if this helps.
Nov ’22
Comment on UserDefaults not cleared after Uninstall
I moved the flag from UserDefaults to existence of a directory that I create on first launch. If it's not important to preserve the existing flag (for example, you don't care that everybody will see the onboarding again) then you can just move to this mechanism. If it is important then you need to "migrate" the current setting: if flag exists then create the directory and delete the flag. In this way the first uninstall + install will not work but the second will
Oct ’22