views:

49

answers:

1

Hi guys, I'm trying to pull an NSUserDefaults value from a Settings.bundle into my application. When I load up the NSUserDefaults on application load, though, an NSLog reveals that my BOOL value returns "(null)" and my String value returns the number 39540360. The weird thing is that the documentation on NSUserDefaults specifically states that

"If a boolean value is associated with defaultName in the user defaults, that value is returned. Otherwise, NO is returned."

So even if the Settings.bundle is not connected (Which I believe to be the case, anyway) it should return NO, right? Regardless, my second part to this question is how would someone call (null) as in if (maxCountEnabled == (null)){ because no nil, NULL, or NSNull method worked.

A: 

The documentation is correct, if you create a new empty project and put the following in the delegate applicationDidFinishLaunching

  NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

  BOOL tst = [defaults boolForKey:@"missingKey"];

The value for tst will be NO

Let me know if you are doing something else

Liam