A solution appears to be [newDoc saveDocumentWithDelegate:
which looks to be a simplified version of [newDoc runModalSavePanelForSaveOperation: In both cases, processing is deferred and the save selector has a BOOL parameter with the desired info (Save or Cancel). Thanks. > On Apr 14, 2016, at 3:09 PM, Quincey Morris > <quinceymor...@rivergatesoftware.com> wrote: > > On Apr 14, 2016, at 11:55 , Michael McLaughlin <mmclaughl...@cox.net > <mailto: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. > -- Michael McLaughlin mmclaughl...@cox.net _______________________________________________ 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