使用Java与OS X 10.8的通知中心(NSUserNotification)

6
我在OS X 10.8中遇到了通知中心的问题。我写了一个包装器,通过JNA提供Java对NSUserNotification和NSUserNotificationCenter类的访问,但其功能受限。只有当.jar文件通过JavaApplicationStub从.app束运行时,我才能发送通知并将其显示出来。但是,在将通知样式设置为“Alerts”时,控制台始终记录以下内容:
11/29/12 8:37:12.537 PM usernoted[162]: Failed to validate application at (null) -67061

接下来,点击通知会导致以下内容被记录到控制台:
11/29/12 8:38:15.291 PM usernoted[162]: Cannot find originating application to launch for event action.  file://localhost/Users/geoffodonnell/Projects/bin/GuiTest.app/ is not the same app as the one that sent the original notification.

我已经为NSUserNotificationCenter类提供了代理,但是只有在.jr执行时才会运行这些方法,而在bundle外部执行。这自然是失败的,因为通知将永远不会显示。
是否有人能够对上述两个错误提供任何见解?
我想知道JavaApplicationStub是否会妨碍,但是当涉及到典型应用程序如何响应通知中心事件时,我就一无所知了。

1
这个包装器是否有开源的可能性? - Wojtek
1
天啊,我不知道@Wojtek是否还需要这个信息,但我会尽力找到它给你。 - Geoff
@Wojtek 是的!在这里:https://github.com/gbosystems/GSInstrumentedAndroidBluetooth - Geoff
1个回答

2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接