Objective-C set bundle setting value

410 Views Asked by At

I created a bundle setting for my app with these options:

and now I have this class called LHTabBarController.m

and I am trying to get the value of Update Lot like so:

Item 1 (Toggle Switch - Update Lot) - Type - Toggle Switch, Title - Update Lot, Identifier - update_lot, Value for ON - YES, Value for OFF - NO, Default Value - YES

BOOL updateLot = [[NSUserDefaults standardUserDefaults] valueForKey:@"update_lot"];

but no matter what it returns as NO when the default is YES....what am I doing wrong here?

In the bundle settings, the setting is on as expected, but I can't seem to get that value. I hope I don't have to do this in AppDelegate because I need to use this value in my class.

1

There are 1 best solutions below

0
l'L'l On BEST ANSWER

Try using boolForKey instead:

BOOL updateLot = [[NSUserDefaults standardUserDefaults] boolForKey:@"update_lot"];

Foundation Framework Reference > NSUserDefaults Class Reference