I have a problem where I’m trying to register a bool as an NSUserDefault. I then want to be able to read this bool value later on. The issue is that when I read the value its not picking it up as a YES.
Here is the code I use to register the value:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *appDefaults = [NSMutableDictionary dictionary];
[appDefaults setValue:@"YES" forKey:kShowHelp];
[defaults registerDefaults:appDefaults];
[defaults synchronize];
I then read the bool using the following:
bool showHelp = [[NSUserDefaults standardUserDefaults] boolForKey:kShowHelp];
Don’t use setValue:forKey: use setObject:forKey: