• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: When saving the managed object context
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >When saving the managed object context (From: Squ Aire <email@hidden>)

  • Prev by Date: Re: Challenge: Block Main Thread while Work is done, with Timeout
  • Next by Date: Re: Comparing NSImages
  • Previous by thread: Re: When saving the managed object context
  • Next by thread: NSSlider with multiple values?
  • Index(es):
    • Date
    • Thread