Updates to NSDictionary attribute in CoreData not saving
Posted
by sfkaos
on Stack Overflow
See other posts from Stack Overflow
or by sfkaos
Published on 2010-05-04T09:08:59Z
Indexed on
2010/05/09
6:18 UTC
Read the original article
Hit count: 408
I have created an Entity in CoreData that includes a Transformable attribute type implemented as an NSDictionary. The NSDictionary attribute only contains values of a custom class. The properties of the custom class are all of type NSString. The custom class complies with NSCoding implementing:
-(void)encodeWithCoder:(NSCoder*)coder;
-(id)initWithCoder:(NSCoder *)coder
When saving the Entity for the first time all attributes including the Transformable (NSDictionary) type are properly saved in the DB. When the same Entity is fetched from the DB and updated (including the Transformable attribute) it seems to be updated properly. However, when the app is closed and then reopened fetching the Entity does not show the updated Transformable attribute-type though the rest of the attributes of type NSDate and NSString are up-to-date. The Transformable attribute is the original saved value not the updated value.
Is this a problem with KVO or am I missing something else when trying to save an NSDictionary filled with a custom class to CoreData?
© Stack Overflow or respective owner