Remove application from Notification Center

前端 未结 11 1784
自闭症患者
自闭症患者 2020-12-08 01:21

Hey I was playing around with making a small cocoa application and using the new Notification Center API in Mountain Lion. However my app is now present in the notification

相关标签:
11条回答
  • 2020-12-08 01:56

    You can do this easily from Xcode.

    Open Organizer, and select the Projects tab at the top. You will see a list of all your applications on the left side. For any application you want to remove, select it from the left-hand menu and choose Delete... for the Derived Data.

    This still retains any user settings in Notification Center, as well as the notifications themselves.

    0 讨论(0)
  • 2020-12-08 01:56

    For macOS Catalina, the path to the db be found with lsof -p $(ps aux | grep -m1 usernoted | awk '{ print $2 }')| awk '{ print $NF }' | grep 'db2/db$' | xargs dirname

    0 讨论(0)
  • 2020-12-08 02:03

    I had trouble with BetterTouchTool not disappearing from the Notification Center after uninstall. Unfortunately, the methods mentioned here didn't work for me but I figured it out eventually.

    For anybody having trouble getting this to work under High Sierra:

    1. In terminal, navigate to NotificationCenter folder:

      cd $(getconf DARWIN_USER_DIR)/com.apple.notificationcenter/
      
    2. get path using pwd and copy to clipboard (should be something like /var/folders/c3/289nmdsd2cz68yd5p47k553w0000gn/0/com.apple.notificationcenter)

      pwd
      
    3. In finder, go to folder (cmd+shift+g) and paste path
    4. Find the folder containing the db file and drag the entire folder to the trash (I had only one folder named "db2")
    5. Empty Trash! (This is very important, didn't work on my machine without it)
    6. Log Out and In again

    There might be a more elegant way but this worked for me. Note that for some reason, the Database gets rebuilt with the application_id still present in the db-table (which is called app instead of app_id on High Sierra, btw), however the entry disappeared from the notification center.

    0 讨论(0)
  • 2020-12-08 02:03
    1. Go to Finder
    2. Search Macintosh HD under the tab "This Mac"
    3. Click Applications
    4. Press Shift + Command + G
    5. Type in ~/library
    6. Click Application Support
    7. Click Notification Center
    8. Drag the only file that's there to the Trash
    9. Quit all on going apps
    10. Empty Trash
    11. Restart

    Tadaaa! The application has been removed to your Notifications Center permanently based on personal experience.

    0 讨论(0)
  • 2020-12-08 02:04

    I was stuck in the same boat.

    While I don't believe purging applications from Notification Center that have once registered is a documented step, there's clearly some stuff setup to do that. Here's what I found out. This data isn't stored in a plist but rather a sqlite database.

    If you look ~/Library/Application Support/NotificationCenter/<id> (in my case, I only had one directory under NotificationCenter), you'll see an <id>.db file under the directory.

    Editor's note: Hofi points out that since macOS 10.10 said SQLite database can be found in the directory returned by shell command
    $(getconf DARWIN_USER_DIR)com.apple.notificationcenter/db, named just db.

    Poking inside, I see tables like app_info, app_source, presented_notifications, etc. Furthermore, the schema includes a clean-up trigger that looks like this:

    CREATE TRIGGER app_deleted AFTER DELETE ON app_info
    BEGIN
        DELETE FROM scheduled_notifications     WHERE app_id=old.app_id;
        DELETE FROM presented_notifications     WHERE app_id=old.app_id;
        DELETE FROM presented_alerts                WHERE app_id=old.app_id;
        DELETE FROM notifications                   WHERE app_id=old.app_id;
        DELETE FROM app_push                        WHERE app_id=old.app_id;
        DELETE FROM app_loc                     WHERE app_id=old.app_id;
         DELETE FROM app_source                 WHERE app_id=old.app_id;
    END;
    

    Using a sqlite3 client, if you do a

    select * from app_info;
    

    the first column is the app_id of your application, the second column is your app's bundleid. Find your application based on the bundleid. Then do a

    delete from app_info where app_id = <app_id>
    

    where is the correct app_id you found using your select command above.

    What was frustrating was that after doing this, everything stayed around in NotificationCenter (both the center and System Preferences). I had to logout and log back in to see the changes take effect, but luckily, my multiple test apps are now gone ;-)

    If anyone knows of a less convoluted way, I'm all ears.

    0 讨论(0)
  • 2020-12-08 02:05

    If you delete the application (might need to empty the trash as well) and log out and back in, it gets removed from the list.

    0 讨论(0)
提交回复
热议问题