The NSUserDefaults
API documentation has the boolForKey:
message which is described like this -
boolForKey:
Returns the Boolean value associated with the specified key.
- (BOOL)boolForKey:(NSString *)defaultName
Return Value If a boolean value is associated with defaultName in the user defaults, that value is returned. Otherwise, NO is returned.
Given that a [[NSUserDefaults standardUserDefaults] boolForKey:@"some_Key"]
gives back a NO it can be either because the key does not exist or the key exists and has a boolean
value NO. How can we differentiate? As of now, I can only avoid getting into this situation in the first place.