Remove scheduled notifications on Mac OSX

568 Views Asked by At

I used C#/Mono to schedule a notification with NSUserNotificationCenter like so:

var not = new NSUserNotification();
not.Title = ...;
not.DeliveryDate = ...;
not.DeliveryRepeatInterval = new NSDateComponents() {
  Second = 65
};
...
NSUserNotificationCenter.DefaultUserNotificationCenter
                        .ScheduleNotification(not);

This worked as intended. An initial notification appeared and then after a 65sec delay the next one and then the next one etc.

But: After I quit the application the notifications kept appearing! And they still do.

I deleted the application and emptied the trash can. I restarted my Mac. I switched notifications for the application on/off in settings/notification center. All to no avail.

I followed advice to delete SQLite notification databases down in the belly of OSX Sierra. There were only old .db files. Nothing changed.

Neither can I remove the application from the notification center, nor can I stop the scheduled notifications.

What else can I do?

PS: To be precise: I checked this posting, but nothing from there worked.

1

There are 1 best solutions below

1
On BEST ANSWER

Ok, I solved the problem myself. The solution indeed was already present in the previous posting. But I somehow did not apply it correctly. So here are the steps if you're stuck with unwanted notifications on OSX Sierra:

  1. Find the notification center database: cd (getconf DARWIN_USER_DIR)/com.apple.notificationcenter/db (replace the () with backticks!)
  2. Determine the full path with pwd, e.g. /var/folders/b4/qw_sstpn1jqd8ypb1zgc7vww0000gn/0/com.apple.notificationcenter/db. This references a directory, not a file yet!
  3. Open the file called db in the directory found, e.g. /var/folders/b4/qw_sstpn1jqd8ypb1zgc7vww0000gn/0/com.apple.notificationcenter/db/db - yes, it's db/db at the end - with a SQLite editor.
  4. Search for you app with select * from app_info where bundleid = "%yourappname%". Remember theapp_id` value shown.
  5. Delete the app info record and thereby any related data in other tables with delete from app_info where app_id = <your app id>.
  6. Save the changes to the database if necessary.
  7. Restart your Mac and log back in. You should be fine now.

I first was confused by my app still being listed in settings/notifications. But at least the annoying notifications don't appear anymore.

Good luck for you!