I am working on an app that uses Core Data as its backend for managing SQLite records. I have everything working with strings and numbers, but have just tried adding BOOL fields and can't seem to get things to work.
In the .xcdatamodel, I have added a field to my object called isCurrentlyForSale
which is not Optional, not Transient, and not Indexed. The attribute's type is set to Boolean with default value NO.
When I created the class files from the data model, the boilerplate code added for this property in the .h header was:
@property (nonatomic, retain) NSNumber * isCurrentlyForSale;
along with the
@dynamic isCurrentlyForSale;
in the .m implementation file.
I've always worked with booleans as simple BOOLs. I've read that I could use NSNumber's numberWithBool
and boolValue
methods, but this seems like an aweful lot of extra code for something so simple.
Can the @property in the header be changed to a simple BOOL? If so is there anything to watch out for?
Thanks -John