I recently put together a Mac OS X app that uses NSUserNotificationMBS to post notifications.
I’ve observed some behaviour that I’d like to verify is correct / as expected.
The behaviour is all to do with what happens if you change the ‘identifier’ for the NSUserNotificationMBS object
I post a notification when the app starts - basically saying ‘it’s starting… hold on’ (this is a background app only) and I set the identifier to a string - something like “34563.0” - where the first part is a random number and the second part is a sequential number.
Because it’s a start-up message and the app can often become ready in only a few seconds I wanted to replace the message with a ‘all good - ready’ message. So to do this, I reuse the same identifier for the second notification.
With the notifications preferences for my app set to ‘Alerts’ (in System Preferences->Notifications) this all works as expected. I get a single notification with the ‘show’ and ‘close’ buttons and a second or so later it get’s replaced with the ‘all good’ notification.
When I switch this to ‘banners’ the behaviour no longer functions like I think it should.
When set to banners, the initial notification appear. A couple of seconds later I see my app delivering the second message with the same identifier but the on-screen notification does not change. If you happen to have the notification center panel displayed on the right of the screen you can observe the content changing but still the pop-up notification does not change.
If I change the code to use a different identifier - I get the opposite behaviour. ‘Banners’ mode now replaces the on-screen pop-up notification and ‘Alerts’ does not.
My understanding of the identifier property was that it was designed to specifically replace an existing notification but it seems to change depending on preferences.
Any comments guys?