Validation error after setting the value of a boolean attribute

2010-02-16 Thread Lynn Barton
Why does my Core Data app give me a validation error message, when quitting the app, if the following code is used? I am importing some legacy data to set 5 string attributes of an object, but using this code to set the one BOOL attribute. In my model, myBooleanAttribute has a default value of

Re: Validation error after setting the value of a boolean attribute

2010-02-16 Thread Steven Degutis
Boolean attributes in Core Data are not actually of type BOOL but rather NSNumber. Thus, your NO value is interpreted as nil (since nil == 0 == NO) and you're setting your attribute to nil. If the attribute is required, then nil is not a valid value, and you will get a validation error. Next time,

Re: Validation error after setting the value of a boolean attribute

2010-02-16 Thread Lynn Barton
On Feb 16, 2010, at 2:38 PM, Steven Degutis wrote: Boolean attributes in Core Data are not actually of type BOOL but rather NSNumber. Thus, your NO value is interpreted as nil (since nil == 0 == NO) and you're setting your attribute to nil. If the attribute is required, then nil is not a