I'm skeptical of this in the first place because you shouldn't be placing a BOOL into any collection or object you can call valueForKey:
on. Generally, collections that observe key-value coding should only contain objects as values (hence the id
type of values to be inserted).
This is especially true of Core Data objects, which I think you're using - they don't allow people to store BOOLs as BOOLs, but instead as NSNumbers (technically NSCFBoolean, a private subclass of NSNumber).
What you should probably do is, where you insert the value (if Core Data doesn't do it for you), wrap the BOOL in an NSNumber. Something like:
// Given some NSManagedObject *managedObject with Boolean property boolProperty
BOOL myBool = YES;
NSNumber *myBoolAsNumber = [NSNumber numberWithBool:myBool];
managedObject.boolProperty = myBoolAsNumber;
Then, when you fetch it, you can grab the BOOL value back out again using NSNumber's boolValue
method. For example:
// Given same managedObject:
NSNumber *myBoolAsNumber = managedObject.boolProperty;
BOOL myBool = [myBoolAsNumber boolValue]