After completely removing the application from the device, and then downloading it to the debugger, I am trying to establish a way to load the flag using boolForKey. The first time I run the application, I have the expectation that bool will not exist, since I just reinstalled the application. I expect from the documentation that boolForKey will return NO.
I see the opposite. boolForKey returns YES, which confuses my initial user settings. Any idea why this could be happening or something like that?
BOOL stopAutoLogin = [[NSUserDefaults standardUserDefaults] boolForKey:@"StopAutoLogin"]; _userWantsAutoLogin = !stopAutoLogin;
So, stopAutoLogin comes out as "YES", which is completely unexpected.
Stranger and stranger: When I call objectForKey: @ "StopAutoLogin", I get a null object, as expected. This is just a boolForKey that returns bad value. So I changed the code to this:
// this is nil NSObject *wrapper = [[NSUserDefaults standardUserDefaults] objectForKey:@"StopAutoLogin"]; // this is YES BOOL stopAutoLogin = [[NSUserDefaults standardUserDefaults] boolForKey:@"StopAutoLogin"];
source share