4

Is there (now) a officially supported way to change the OSX Notification Center's Icon for NSUserNotifications while my App is running? I searched the web, but the answers weren't really "recent", so I just wanted to double check.

I'd like to show the currently playing spotify track's Artwork next to it's title / name

What I tried until now is really ugly:

  1. temporarily replacing the CFBundleIconFile of my app with a IconFamily generated .icns file (I know i shouldn't modify anthing inside the bundle, but I'm not aiming to get the app to the App Store)

  2. restart Notification Center to "forget" it's eventually cached icons

    NSRunningApplication* notificationCenter = [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.notificationcenterui"]; [notificationCenter terminate];

    (i know I REALLY SHOULDN'T do this)

Community
  • 1
  • 1
blub
  • 1,014
  • 7
  • 18

1 Answers1

5

If you are NOT going to submit your app to App Store, there's a private API in 10.9 that does what iTunes did:

NSUserNotification *notification = [NSUserNotification new];
[notification setValue:anImage forKey:@"_identityImage"];

enter image description here

Cai
  • 3,609
  • 2
  • 19
  • 39