Reputation: 979
I have an app or two for which I want a "Reset all settings" button.
I have noticed as of Yosemite or so, defaults are cached in some strange ways by OS X and from the terminal executing a defaults delete com.mycompany.myapp
does not work consistently at all. I usually also need to issue a defaults write com.mycompany.app dummy dummy
I suspect this has largely to do with SandBoxing...
I want to reliably implement resetting defaults, as well as cleaning up my sandbox and cache directories.
Any ideas?
Upvotes: 0
Views: 315
Reputation: 90551
If you're doing this from within the same app whose settings you want to reset, try:
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:[[NSBundle mainBundle] bundleIdentifier]];
Upvotes: 1