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?

有帮助吗?

解决方案

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!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top