Re: When saving the managed object context
Re: When saving the managed object context
- Subject: Re: When saving the managed object context
- From: Mike Abdullah <email@hidden>
- Date: Fri, 24 Jul 2009 17:07:22 +0100
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 (email@hidden)
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:
This email sent to email@hidden