Return to Snippet

Revision: 7416
at July 22, 2008 23:40 by zingo


Initial Code
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *keys = [[defaults dictionaryRepresentation] allKeys];

int i, count = [keys count];
for (i = 0; i < count; i++) {
   [defaults removeObjectForKey:[keys objectAtIndex:i]];
}

[defaults synchronize];

Initial URL
http://www.starcoder.com/wordpress/2007/02/13/removing-preferences-belonging-to-your-app/

Initial Description
Remove all the keys of the application’s preferences file from ~/Library/Preferences with Cocoa’s NSUserDefaults class.

Initial Title
Removing preferences belonging to your app

Initial Tags
osx

Initial Language
Objective C