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

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

Initial Language
Objective C