Существует более простой способ, просто проверьте содержимое [runModal]
в операторе if:
//setup the dialog
NSAlert *networkErrorDialog = [NSAlert alertWithMessageText:@"Couldn't connect to the server" defaultButton:@"Network Diagnostics" alternateButton:@"Quit" otherButton:nil informativeTextWithFormat:@"Check that your computer is connected to the internet and make sure you aren't using a proxy server or parental controls"];
//show the dialog inside an IF, 0=the first button 1=the 2nd button etc
if ([networkErrorDialog runModal]==0) {
//quit
[[NSApplication sharedApplication] terminate:self];
} else {
//Network Diagnostics
[[NSWorkspace sharedWorkspace] launchApplication:@"Network Diagnostics"];
[[NSApplication sharedApplication] terminate:self];
}
Надеюсь, что поможет