• 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: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?


  • Subject: Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
  • From: Gideon King <email@hidden>
  • Date: Thu, 29 Jul 2010 13:07:52 +1000

Thanks Jerry, it is part of an NSPersistentDocument subclass. I get a bit confused about which save method(s) I would have to implement in my subclass, as there seem to be a number of save... methods and a number of writeTo... methods. The potential candidates seem to be:

saveDocument:
saveDocumentWithDelegate:didSaveSelector:contextInfo:
saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:
saveToURL:ofType:forSaveOperation:error:
writeSafelyToURL:ofType:forSaveOperation:error:
writeToURL:ofType:forSaveOperation:originalContentsURL:error:
writeToURL:ofType:error:

From my reading of the documentation, the first place in the chain that you are absolutely sure that the user is going to save, and not back out of a save panel or something would be saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo: so I guess it would be fine for me to override that, send my notification, and call super...


On 29/07/2010, at 12:36 PM, Jerry Krinock wrote:

>
> 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

  • Follow-Ups:
    • Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
      • From: Jerry Krinock <email@hidden>
References: 
 >Equivalent of NSManagedObjectContextWillSaveNotification in 10.5? (From: Gideon King <email@hidden>)
 >Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: NSPathControl w/ popups and icons
  • Next by Date: [Moderator] Re: NSPathControl w/ popups and icons
  • Previous by thread: Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
  • Next by thread: Re: Equivalent of NSManagedObjectContextWillSaveNotification in 10.5?
  • Index(es):
    • Date
    • Thread