On 22 Jul 2009, at 15:22, Squ Aire wrote:


How can I do some custom stuff before my NSManagedObjectContext saves? (I want to cleanup some "garbage" that might get created while my app is running). In my case this would be faster to do than override my NSManagedObject didTurnIntoFault.

So, to do this, is it safe for me to subclass NSManagedObjectContext and override save:? Or is this one of those methods I should not override? Any better ways?

As you long as you call super's implementation (obviously!), then yes it's safe. But watch out for the fact that during a store migration, Core Data may well internally use a different MOC and save it, ignoring your subclass.

Mike.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to