Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
- Subject: Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
- From: Jerry Krinock <email@hidden>
- Date: Wed, 28 Jul 2010 19:36:39 -0700
On 2010 Jul 28, at 15:43, Gideon King wrote:
> I was successfully using NSManagedObjectContextWillSaveNotification in 10.6, but have to also support OS X 10.5, where that notification is not available. Was there some notification sent prior to 10.6?
I'm not sure, but if it was, Apple probably wouldn't have added it in 10.6. They are rather busy, I'm told :)
> use a subclass of NSManagedObjectContext
No. NSManagedObjectContext documentation says "no".
> then I would like to know where/how to make the switch so I don't get tripped up by what coredata does behind the scenes…
Uh, unless you like to spend alot of time writing code, I'd recommend you forget that.
> Another option that came to mind would be a simple method swizzle on the save: method. Maybe that would be a better option, but I'd like to hear what others did in 10.5...
If this is a document's managed object context, there are lots of methods in NSDocument which you can subclass to post a notification. Otherwise, you could wrap -[NSManagedObjectContext save:] in your own -save… method in some other class, say whatever "owns" this managed object context, and use your new -save… method instead.
_______________________________________________
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