Claus Jørgensen Claus Jørgensen - 1 year ago 66
Swift Question

Setting NSLocalizedRecoveryOptionsErrorKey as NSError UserInfo doesn't provide any recovery options

Attempting to set some custom buttons for

isn't working. Only the standard "OK" button is displayed.

NSApp.presentError(NSError(domain: "", code: 0, userInfo: [
NSLocalizedRecoveryOptionsErrorKey: ["Foo", "Bar"]

It also have no effect setting any of the other UserInfo keys.

Is this simply no longer supported on OS X 10.11 ?


enter image description here

NSError *error = [NSError errorWithDomain:@"MyCoolDomain" code:1 userInfo:@{
                          NSLocalizedDescriptionKey: @"Could Not Post Message",
                          NSLocalizedFailureReasonErrorKey: @"We could not reach the XING server. Your internet connection seems to be offline.",
                          NSLocalizedRecoverySuggestionErrorKey: @"You may try again when you are online again.",
                          NSLocalizedRecoveryOptionsErrorKey: @[@"Try again", @"Cancel"]
    NSAlert *alert = [NSAlert alertWithError:error];
    alert.informativeText = [error.localizedFailureReason stringByAppendingFormat:@"\n\n%@", alert.informativeText];
    [alert beginSheetModalForWindow:self.view.window completionHandler:^(NSModalResponse returnCode) {

Try this. source :

When I face issues like these, I go searching for other people's code / issues.