I can't figure out why my didEndSelector isn't being called. Any ideas?
- (void) showMonitorAlertIfNeeded {
if (! self.monitorAlert && [self isHideMonitorAlert]) {
self.monitorAlert = [MMAlertController monitorAlert];
[[self.monitorAlert window] setTitle: [self applicationName]];
[self.monitorAlert beginSheetModalForWindow: [NSApp keyWindow]
modalDelegate: self
didEndSelector: @selector(monitorAlertDidEnd:returnCode:contextInfo:)
contextInfo: nil];
[[self.monitorAlert window] setLevel: NSScreenSaverWindowLevel];
}
}
- (void) monitorAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) code contextInfo: (id) contextInfo {
switch (code) {
case NSAlertFirstButtonReturn:{
}
NSLog(@"FIRST BUTTON PRESSED");
break;
case NSAlertSecondButtonReturn:{ // don't show again.
NSLog(@"SECOND BUTTON PRESSED");
[[NSApp delegate]setIsHideMonitorAlert:NO];
}
break;
default:
break;
}
}
Try to insert this line just before the switch:
NSLog(@"code: %ld", code);