If something goes wrong saving a file, I'd like to show the error alert as a sheet over the save sheet, as overwrite prompt does. However, the save panel closes immediately upon the completion of the completion block, taking the error alert with it.
[panel beginSheetModalForWindow:window
completionHandler:^(NSInteger result) {
if (result == NSFileHandlingPanelOKButton) {
NSError *error;
// Do my saving here...
if (error)
[[NSAlert alertWithError:error] beginSheetModalForWindow:panel
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
}
}];
Can I cancel hiding the NSSavePanel from within the completion block? From a delegate? From anything?