0

I'm trying to get 2 notifications to pop up at once, stacked on top of eachother, but when I deliver the second notification, it pushes the first popup out of the display.

     NSUserNotification *notification = [[NSUserNotification alloc] init];
     notification.title = @"1";
     notification.informativeText = [NSString stringWithFormat:@"First Popup"];
     notification.soundName = NSUserNotificationDefaultSoundName;
     [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];

     NSUserNotification *notification2 = [[NSUserNotification alloc] init];
     notification2.title = @"2";
     notification2.informativeText = [NSString stringWithFormat:@"Second Popup"];
     notification2.soundName = NSUserNotificationDefaultSoundName;
     [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification2];

Is there a flag or something I could set to stop the second popup from removing the first one from my display? (They both still exist in the notification center)

A O
  • 5,516
  • 3
  • 33
  • 68

1 Answers1

0

You have to enable notifications to show as Alerts in the Notifications in System Preference.

popup with close button

and then you can remove/dismiss the notifications as/if you want using:

- (void)removeDeliveredNotification:(NSUserNotification *)notification;

You can use Growl also for the purpose but i don't know if that will show notifications in notification center. I don't know any other way of doing this and will love to learn that.

Notification Center

bikram990
  • 1,085
  • 1
  • 14
  • 36
  • ah, so you don't think i can programmatically force the notifications to be alerts for the user? – A O Jul 29 '14 at 12:42
  • you can do that. just look at http://stackoverflow.com/questions/12320051/can-an-app-use-both-alerts-and-banners-in-notification-center – bikram990 Jul 30 '14 at 03:44
  • i hope the link helps, but again the user will have the power to change style from `System Preferences`. – bikram990 Jul 30 '14 at 03:51