Reputation: 15
My scenario: I have an app that sends a notification to the OS X Notification Center with a button. This notification is to tell me when someone rings our dock doorbell. The button is suppose to pull up a NSWindow that shows our dock camera. I can get the window to come up with a NSButton within the app, but I can't get it to come up with the notification button.
I have tried:
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification {
if ([notification.title isEqualToString:@"Doorbell"]) {
[DockCameraWindow makeKeyAndOrderFront:nil];
NSLog(@"CameraWindow");
}
[[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications];
}
The log shows up, however the window doesn't. My application however does take the front app status.
Upvotes: 1
Views: 405
Reputation: 15015
Did you try this :--
[NSApp activateIgnoringOtherApps:YES];
Upvotes: 2