We don't need no stinking badges

from blog The Desolation of Blog, | ↗ original
This is a follow-up to How to Badge an App’s Icon in the Dock by Matthias Gansrigler, or as he's known in the developer community, "Rig". I want to thank Rig for helping me to solve a problem with NSUserNotification. My app posts notifications to Notification Center using -[NSUserNotificationCenter deliverNotification:], and this worked fine for alerts and sounds, but I couldn't figure out how to handle the "Badge app icon" setting in System Preferences, Notifications. The documentation for NSUserNotification is sparse and implies that Notification Center handles everything automatically. The reality is that developers need to do almost everything themselves. Rig's blog post talked about an app that only shows a Dock badge, so I want to expand on that to talk about an app that shows alerts and plays sounds in addition to badging the Dock icon. Here's the code that I use to show an "unread" count: