NSUserNotifications - verify behaviour

Hi all,
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?

Thanks

dave

Well, maybe a bug on Apple’s side?

Or maybe you better delete old notification and than schedule the new one?

I would suggest that rather than replace, you remove the first notification and then post the second one, or post the second one and remove the first one.

You can set the default from your application, in App Wrapper, click on the action icon next to “High Resolution Mode” on the “General” settings. In here you can specify the default Notification style.

I would also suggest that you might reconsider the means of letting the user know the application is ready to use. Firstly a user can disable notifications for your application if they don’t want to see them anymore, and secondly AFAIK it’s not common practice to notify the user that the app is ready via a notification.

Thanks all - worthy suggestions of course. I have a version that can delete the old notification and post a new one and but the effect is not as slick as simply replacing.

I have a default notification style defined in the app and actually I have some code to monitor if notifications are set to ‘none’ and can warn the user about that.

Agree on the use of the ‘ready to start’ notification being replaced, I will probably revised that specific workflow, but the question / problem remains.

Using the ‘identifier’ to replace a notification behaves differently depending on if banner or alerts are set and I am not sure if that is simply a bug or as design.

I modified Christians original example UserNotification project to help demonstrate this;
https://drive.google.com/open?id=0B1_UR9WdYSy8eDF0alhiTUprR2M

Try running the project and posting multiple notification using the “Send now” button.

Thanks