I am trying to display badge count in MacOS Ventura for my application, Here is my code
NSApplication.shared.dockTile.showsApplicationBadge = true
NSApplication.shared.dockTile.badgeLabel = "2"
NSApplication.shared.dockTile.display()
I also requested for notification allow
//create the notificationCenter
let center = UNUserNotificationCenter.current()
center.delegate = self
// set the type as sound or badge
center.requestAuthorization(options: [.sound,.alert,.badge]) { (granted, error) in
if granted {
print("Notification Enable Successfully")
}else{
print(error.debugDescription) // prints "Notifications are not allowed for this application"
}
}
but it is always going into error part, I don't know what's issue there. I also checked in Notification settings in System preference, It's showing only alert there. There is no badge setting there.
How to add badge setting in notification setting? Here is the screenshot
Any help would be appreciated.
