On Jan 16, 2013, at 13:36 , Eric Gorr <mail...@ericgorr.net> wrote:

> I need to override runModalSavePanelForSaveOperation in NSDocument to provide 
> some custom behavior.

I'd suggest you keep trying to find a way to avoid doing this. Even 
inconveniences like having to work through an extra dialog before or after the 
standard save panel might be preferable.

The problem is that the list of things that that the "default implementation" 
of such methods has changed over time from 10.5-10.8. If you override one and 
*don't* call super, then your app may inexplicably break in a future OS X.

> According to the description in the documentation, one needs to call 
> saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo: which 
> I am doing. However, my 
> writeToURL:ofType:forSaveOperation:originalContentsURL:error: method is not 
> called and I was expecting it to be. If I use the default 
> runModalSavePanelForSaveOperation, it will be.

You use the word "call", but that's not what you're supposed to do -- you need 
to invoke a NSInvocation. Perhaps what you meant. If not, the process is 
explained in these old release notes:

        
https://developer.apple.com/library/mac/#releasenotes/Cocoa/AppKitOlderNotes.html

under this heading:

        Advice for Overriders of Methods that Follow the 
delegate:didSomethingSelector:contextInfo: Pattern

> (I am also wondering how to properly handle the process to "make sure that 
> any editor registered using the Cocoa Bindings NSEditorRegistration informal 
> protocol has committed its changes.")

NSDocument implements this protocol already (though it's not documented as 
doing so), so you simply need to send one of the 'commit…' methods to self, I 
suppose. However, without an API contract beyond what you quoted, it's not 
absolutely clear it's that simple.
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to