Can someone please help me understand why this bool isn’t saving?
Here is my code in the view did load:
[appDelegate.defaults setBool:YES forKey:@"testKey"];
[appDelegate.defaults synchronize];
NSLog (@"TEST BOOL VALUE = %@", [appDelegate.defaults boolForKey:@"testKey"] ? @"YES" : @"NO");
In the app delegate applicationDidFinishLaunching, I define appdelegate.defaults as this:
self.defaults = [NSUserDefaults standardUserDefaults];
Why is this not working I honestly have no idea.
Thanks!!
appDelegateisnilwhen you are calling the mentioned code.Try adding an
NSSlogto check that: