Posts Tagged store bool in core data
If you want to insert BOOL type into core data, you can do it with NSNumber’s member method +numberWithBool:
BOOL myBool = YES; NSNumber *boolAsNumber = [NSNumber numberWithBool:myBool]; //now you can pass boolAsNumber into you managed object for storage!
If you want to retrieve a BOOL from NSNumber you can use -boolValue.
NSNumber *boolAsNumber = [NSNumber numberWithBool:NO]; BOOL getBool = [boolAsNumber boolValue];