I am using XCode4.2 and developing and iPhone App
I ususally save data using NSUserdefaults (mainly strings … )
I usually write the following two lines to save the data :
historyvar=[NSUserDefaults standardUserDefaults];
[historyvar setObject:boolVar forKey:@"bool"];
I am trying to save a BOOL variable but I get a red error when I do that :
Implicit converstion of'BOOL' (aka 'signed char') to 'id' is disallowed with ARC
and I get a warning (yellow error)
incompatible integer to pointer conversion sending ‘BOOL'(aka ‘signed char’) to parameters of type ‘id’
is there anything equivalent to NSUserDefaults for Bool varibles ?
thanks
There’s a -setBool:forKey: method of NSUserDefaults.
and then you’ll be able to get an actual BOOL value returned like this:
This way you don’t have to mess with NSNumbers.