On Apr 14, 2016, at 11:55 , Michael McLaughlin <mmclaughl...@cox.net> wrote: > > What is the recommended way to capture a Cancel in this case? Any sample code > available?
If you look in the header file NSDocument.h, you’ll see that ‘saveDocumentAs' (by default) invokes ‘runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo’. If you think about it, that’s why there’s no return value from that method — there is no result until “later”. So, you need to invoke ‘runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo’ yourself, instead of ‘saveDocumentAs’, and deal with the fact that the completion is asynchronous. (AFAIK there is no block-based equivalent of this yet, so you have to deal with the awkward selector invocation, being careful to do proper memory management on the ‘contextInfo’ parameter, if you’re passing a reference counted pointer in that parameter, because ARC doesn’t manage it automatically. _______________________________________________ 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