Reputation: 1117
I need to reset by database and userdefaults value in my OS X app. How can I do it? In IOS app we have an option like 'Reset contents and settings'. But I don't see such an option when I run OS X app. What I'm doing right now is, drill down to /users/library and delete the .storedata file under my project folder. But with this method I am not able to reset my userdefaults value. Is there any other way out? I am new to OS X programing.
Thanks in advance!
Upvotes: 1
Views: 694
Reputation: 668
I have this in a DebugViewController:
- (void)removeUserDefaults {
[[NSUserDefaults standardUserDefaults] setPersistentDomain:[NSDictionary dictionary] forName:[[NSBundle mainBundle] bundleIdentifier]];
}
Then I can delete the UserDefaults with a Button-Press.
Upvotes: 1
Reputation: 50697
You will need to manually nil the values of your NSUserDefaults and delete the database al-together and then recreate it. Best option would be to include an empty database and copy it over to the Library folder (or wherever you access it) if it does not exist.
Upvotes: 1