On 28-May-09, at 10:39 AM, Keary Suska wrote:

On May 28, 2009, at 7:03 AM, Rick Hoge wrote:


I have a core data (doc-based) app in which one of the entities includes a custom object as a persistent attribute. The custom object class implements NSCoding, and these objects are saved to the core data store with no problem (they are read back correctly etc). Instance variables of the custom object are exposed in the user interface, and can be edited by the user.

The problem I have is that changes to instance variables of these custom objects are not reported to the managed object context, so the core data document is not flagged as dirty and, even if I force a save by adding an entity and invoking save, the modified custom object is not saved (if I quit and reload the old ivar values are loaded).

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdNSAttributes.html#/ /apple_ref/doc/uid/TP40001919

Thanks - I'd looked at this, and following the information there is what allowed me to insert and display custom object attributes. The documentation shows examples in which an attribute of type NSColor can be set and archived. My problem is that I'm dealing with a complex object type (I have what I think are good reasons for doing this) and I need to flag the context as dirty if an ivar of the custom object is modified.

Specifically my entity has a 'transformable' attribute for which the values are a custom object class, and this object class has an ivar that is an NSMutableDictionary. The user can modify entries in this dictionary, and I would like this to cause the context to be flagged as dirty and to have the custom object flagged to be updated in the persistent store.

Hope this clarifies things, and thanks again for the suggestion.

Rick


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


(43092.6825)

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to