Quote:
Originally Posted by RickMaddy
A few things. First off, just register the defaults every time. They won't interfere with the real values.
Second, you can put boolean values in a dictionary that way.
Last, no need to synchronize the defaults. They won't get written anyway. They just act as a backup in case a key isn't found.
So your code should be:
Code:
NSDictionary *initDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], kPKey, @"Z", kFKey, [NSNumber numberWithBool:YES], kMKey, [NSNumber numberWithBool:NO], kCKey, [NSNumber numberWithBool:YES], kVKey, nil];
[myDefaults registerDefaults:initDefaults];
That's it. Just do this on app startup before you need to access anything from NSUserDefaults.
|
Beautiful! Worked like a charm--where do I send the royalty checks when my app hits the big time??? :-)
Thanks very much for your help--hopefully I can be of assistance to some folks here once I get the hang of this...have a good night.