Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CORE DATA] Reinitializing NSManagedObject after redo?



In my program, I insert NSManagedObject subclasses into the to-many relationship of another managed object. When I undo, those subclasses are removed from the to-many relationship, one by one. When I redo, they are added back again. This is what I would expect.

But then I added some custom ivars to my object. Following the documentation, I used the designated initializer - initWithEntity:insertIntoManagedObjectContext: to set up and retain these ivars and used -didTurnIntoFault to release them.

The problem is: when I undo the insertion of MyManagedObject, - didTurnIntoFault fires, freeing my ivars. But when I redo the insertion, -initWithEntity:insertIntoManagedObjectContext: DOES NOT fire, so all of my ivars are nil!

Is there any method that fires when a managed object is inserted back into a relationship because of a redo? -awakeFromInsert doesn't. Neither does -awakeFromFetch. How am I supposed to reinitialize the things destroyed by -didTurnIntoFault?


*scratches head -Joshua Emmons _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.