Wondering if anyone else had come across this, or if there's a reason and I'm doing something wrong.
I have an app with CoreData. In the schema I have a 'content' entity with an 'unlocked' attribute which is set to Boolean.
However when I save out the Obj C class for the entity though Xcode, unlocked appears within content.h as:
@property (nonatomic, retain) NSNumber * unlocked;
If I change it to Boolean in content.h, I get an ARC compiling error. However if I leave it as an NSNumber object when I try and fetch it, it's coming back inconsistently (as in if I have an NSLog printing it, it comes back as a different value each time I run).
I can figure out a fairly obvious work-around, setting unlocked as an NSString to 'yes' or 'no' and compare that at the relevant point, but I wanted to know if anyone knew why this was happening or if there is way to keep it as a Boolean.
Thanks in advance.
CoreData stores objects, which BOOL is not.
[NSNumber numberWithBool:YES]
Is the way to set the attribute and you can use it by reading mybool = [content.unlocked boolValue];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With