Reputation: 1417
Really simple question. How do I get values from settings.bundle. In this case, a boolean value. I've seen this link but it's old and I don't know where to put the code. So I experimented a little myself and came up with this:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults synchronize];
id toggleSwitchValue = [defaults objectForKey:@"debuger"];
BOOL boolToggle = [toggleSwitchValue boolValue];
if (boolToggle) {
NSLog(@"Developer: YES");
}
else {
NSLog(@"Developer: NO");
}
But that didn't work. BTW, I placed it in Appdelegate.m under
- (void)applicationDidBecomeActive:(UIApplication *)application
I also tried using this sample code from apple but it was outdated, I followed it and got a bunch of errors
Regards
Upvotes: 2
Views: 512
Reputation: 3606
Make sure to use the same keys you provide in Settings.bundle
.
id toggleSwitchValue = [defaults objectForKey:@"debugger"];
Upvotes: 2