I am guessing a few people have read his book and might be able to help me out with this challenge. For those who have not read the book, the challenge is to add a button to a preference panel to reset the values in the NSUserDefaults standardUserDefaults "BNREmptyDocKey" and "BNRTableBgColorKey" keys. One is a stores data for a collorWell, and the other for a checkbox. This is the code that I came up with, that just doesn't work
. I get a warning, "Warning: passing argument 1 of 'registerDefaults:' from distinct Objective-C type". Anyone have an idea how this is supposed to work?
- (IBAction)resetDefaults
id)sender
{
NSUserDefaults *defaults;
defaults = [NSUserDefaults standardUserDefaults];
[defaults removeObjectForKey
"BNREmptyDocKey"];
[defaults removeObjectForKey
"BNRTableBgColorKey"];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
}
- (IBAction)resetDefaults
{
NSUserDefaults *defaults;
defaults = [NSUserDefaults standardUserDefaults];
[defaults removeObjectForKey
[defaults removeObjectForKey
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
}