TonyNeallon TonyNeallon - 1 year ago 107
iOS Question

Clearing NSUserDefaults

I'm using

+[NSUserDefaults standardUserDefaults]
to store application settings. This consists of roughly a dozen string values. Is it possible to delete these values permanently instead of just setting them to a default value?

Answer Source

You can remove the application's persistent domain like this:

NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];

This is similar to the answer by @samvermette but is a little bit cleaner IMO.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download