3

I was trying to figure out a way how to capture notifications coming from - for example - the integrated mail.app. I was using the NSUserNotifications and acted as an observer but none of the Mail.app notifications were captured.

Is there a way in cocoa to capture NSNotifications coming from other apps? Especially the Mail.app?

Eimantas
  • 48,927
  • 17
  • 132
  • 168
Simon Kemper
  • 635
  • 1
  • 7
  • 16
  • I don't think there is a way unless you are listening for distributed notifications and Mail.app is actually sending them. – Eimantas Oct 24 '13 at 12:05
  • i just tried it but without success. Mail.app was showing an incoming new mail via Notification but this notification was not captures by my NSDistributed... Observer – Simon Kemper Oct 24 '13 at 12:09

1 Answers1

-1

Although it is not possible to capture Mail.app notifications it is possible to use a NSMetadataQuery Live Search with a predicate bound to kMDItemType == "com.apple.mail.emlx" to start a live query including all mails. Everytime the user receives a new mail - the query will be updated!

This is not the answer to my question but this is my working workaround!

Simon Kemper
  • 635
  • 1
  • 7
  • 16