Even the old selector-based one could return NSModalResponse values - I saw it 
happen once in some over-paranoid code that had a switch for the resultCode and 
an assert in the default case. Surprise, it wasn't handling Abort.

NSSavePanel doc shows it as just 

- (void)beginSheetModalForWindow:(NSWindow *)window completionHandler:(void 
(^)(NSInteger result))handler

Apple probably decided NSModalResponse was more specific and didn't update the 
docs to say that's what we'd been getting all along.
________________________________________
From: cocoa-dev-bounces+lrucker=vmware....@lists.apple.com 
[cocoa-dev-bounces+lrucker=vmware....@lists.apple.com] on behalf of Gerriet M. 
Denkmann [gerr...@mdenkmann.de]
Sent: Tuesday, October 21, 2014 8:59 PM
To: cocoa-dev@lists.apple.com
Subject: Return values of NSAlert

NSAlert has: - (void)beginSheetModalForWindow:(NSWindow *)sheetWindow
               completionHandler:(void (^)(NSModalResponse returnCode))handler

NSModalResponse has three values: Stop, Abort, Continue - none of which bear 
any resemblance with the buttons: Default, Alternate, Other in my NSAlert.

Also the actually returned values are not among those in NSModalResponse.

They look like NSAlertDefaultReturn, NSAlertAlternateReturn instead - but this 
clearly cannot be the case, as these values are deprecated: "These constants 
are deprecated in 10.9 and will be formally deprecated in the following release"

The suggested alternative is NSAlertFirstButtonReturn, etc., which have values, 
which very much unlike the actual returned values.

And the header mentions:
"Note that these return values (i.e. NSAlertFirstButtonReturn  etc. ) do not 
apply to an NSAlert created via 
+alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:,
 which instead uses the same return values as NSRunAlertPanel.  See 
NSAlertDefaultReturn, etc. in NSPanel.h"

Which brings us back to the already deprecated values.

I am mightily confused.

Maybe somebody understands this.

Gerriet.


_______________________________________________

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://urldefense.proofpoint.com/v1/url?u=https://lists.apple.com/mailman/options/cocoa-dev/lrucker%2540vmware.com&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=yJFJhaNnTZDfFSSz1U9TSNMmxGyib3KjZGuKfIhHLxA%3D%0A&m=RAXYh7kVcuGG7tnUuT6c5f0g%2FZpqH9zzUCNL3CvEVKY%3D%0A&s=c64267605e0f0e551ae4b939d35a59e98c660317ec3394b0adccb6f97c6f3c24

This email sent to lruc...@vmware.com
_______________________________________________

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