ios - Objective-C set bundle setting value -


i created bundle setting app these options:

and have class called lhtabbarcontroller.m

and trying value of update lot so:

item 1 (toggle switch - update lot) - type - toggle switch, title - update lot, identifier - update_lot, value on - yes, value off - no, default value - yes

bool updatelot = [[nsuserdefaults standarduserdefaults] valueforkey:@"update_lot"]; 

but no matter returns no when default yes....what doing wrong here?

in bundle settings, setting on expected, can't seem value. hope don't have in appdelegate because need use value in class.

try using boolforkey instead:

bool updatelot = [[nsuserdefaults standarduserdefaults] boolforkey:@"update_lot"]; 

foundation framework reference > nsuserdefaults class reference


Comments