问题标签 [nsusernotificationcenter]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
applescript - AppleScripting an app to change background of Notification Center in OSX 10.8
here's my code:
What do I need to change to make it work? It should let you choose a folder, if in that folder there's a file called linen.tiff
then copy that file to a set path:
replacing the one that already exist...
In troubles setting the path and making it work
cocoa - removeDeliveredNotification:没有
我的 Mac 应用程序中有一些代码执行长时间运行的导出操作。在导出结束时,它会创建一个用户通知,让用户知道它已完成:
然后它会放置一张包含导出详细信息的表格(遇到的警告,方便的“显示”按钮等)。当他们关闭工作表时,我想删除通知,如下所示:
但是,这实际上并没有从通知中心删除通知。我设置了一个断点;该-removeDeliveredNotification:
行已运行,并且note
不为零。是什么赋予了?
objective-c - Cocoa / NSUserNotificationCenter 获取所有 NSUserNotification 通知
每当任何应用程序交付或激活一个NSUserNotification
?
- 我也无法确定通过 发送的任何内容
NSDistributedNotificationCenter
, - 我也找不到像
NSUserNotificationDeliveredMask
[dummy name] 这样可以注册全局的掩码[NSEvent addGlobalMonitorForEventsMatchingMask]
, - 默认用户通知中心对象似乎也没有合适的观察者。
The[NSUserNotificationCenter defaultCenter]
及其委托仅在我自己的应用程序发送通知时通知我。
nsusernotification - NSUserNotificationCenter not showing notifications
I'm not sure if I got something wrong but from the examples I could find. I wrote that little helloworld.
I compile it with:
It compiles and I can execute it but it won't show anything. For some reasons, nothing gets presented. I read that Notifications may not get displayed if the application is the main actor. How can I make it show Notification?
python - NSUserNotificationCenter.defaultUserNotificationCenter() 在 python 中返回 None
我正在尝试通过 python 连接到 Mountain Lion 通知中心。我已经安装了 pyobjc 并按照此处和此处的说明进行操作。另请参阅:使用 PyObjC 处理 Mountain Lion 的通知中心
这是我的代码:
当我用参数调用通知函数时,我得到一个属性错误:
AttributeError: 'NoneType' object has no attribute 'scheduleNotification_'
我不明白为什么NSUserNotificationCenter.defaultUserNotificationCenter()
要返回 NoneType 对象。我无法在互联网或 SO 上查询有关此事的任何内容。
mono - NSUserNotificationCenterDelegate 方法不只在一台机器上调用
我正在尝试使用NSUserNotificationCenter
. 我能够成功发送通知。我正在使用ShouldPresentNotification
回调NSUserNotificationCenterDelegate
来显示通知,即使应用程序在前台运行也是如此。
这很好用,除了在我的一台机器上!
我已将代码精简为最基本的示例。我所有的机器都运行 10.8.3 和 Mono 2.10.12。在我的 2008 Macbook Pro 和同事的 2012 rMBP 上,一切正常。但是,在我相同的 2012 rMBP 上,如果应用程序在前台,则不会显示通知。事实上,在这台机器上,并且仅在这台机器上,没有NSUserNotificationCenterDelegate
调用任何方法。
请注意,通知仍然在这台机器上传递 - 通知有效 - 当应用程序处于前台时它不会呈现(因为从不调用委托方法)。
如果有人对可能导致此行为的设置或配置有所了解,或者是否有某种机制可以用来调试此行为,我将不胜感激。
这是我的代码:
objective-c - 有没有办法知道 NSUserNotificationCenter 中有多少个 NSUserNotification?
NSUserNotificationCenter
是否有任何非私人方式可以知道Mountain Lion的通知中心 ( ) 中有多少通知?不仅仅是来自我的应用程序的通知,而是来自所有应用程序的通知。
所以,总而言之,我想做的是检索此处显示的通知数量:
我试图四处搜索,但找不到有关此的信息。有任何想法吗?
提前致谢!
objective-c - 创建自定义 NSUserNotificationCenter 实例
如何创建新的自定义NSUserNotificationCenter
实例?我不是说[NSUserNotificationCenter defaultUserNotificationCenter]
,我的意思是[NSUserNotificationCenter new]
(对我来说不起作用)。
objective-c - How to remove NSUserNotification
I am using NSUserNotificationCenter to display scheduled Notifications. I have notifications of my app in the right side notification panel so whenever I click on the notification it'll launch the app but it won't remove notification from the panel.
- When app is not running and I clicked on the notification, applicationDidFinishLaunching is called and it won't remove notification because didActivateNotification delegate is not called.
- When application is already running and I clicked on the notification, appShouldHandleReopen is called. And won't call the delegate.
-(void)userNotificationCenter:(id)center didActivateNotification:(id)notification
I checked behavior in all the standard app they will remove notification when user click on the notifications.
I have implemented it as follows:
However this is not working in my case. Please let me know some pointer on it...
Other thing I observed:
- When I implement NSUserNotificationDelegate into AppDelegate it'll work for 2nd case i.e. (When application is already running and I clicked on the notification) - in this case notification is removed.
And for deleting notification for 1st case i.e. (When app is not running and I clicked on the notification, appDidFinishLaunching is called) I wrote following code in appDidFinishLaunching.
NSUserNotification *userNoti = [[notification userInfo] valueForKey:@"NSApplicationLaunchUserNotificationKey"]; [[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification:userNoti];
- Can anybody let me know whats the reason, why this works in the AppDelegate but not in my above implementation or Am I doing something wrong in first one?
- Is my AppDelegate implementation fine to handle my both scenarios?
Thanks in Advance.
python - 如何在 py2app 中包含 NSUserNotificationCenter
我在 mac osx 10.8.5 上的 python 2.7 中制作应用程序我想显示通知次数,因此使用NSUserNotificationCenter
. 在 Eclipse 上运行代码时会收到通知。但是,问题是when I made app using py2app, Notifications are not coming
。此外,打开控制台和终止的默认错误页面即将到来。请提出一些建议,如何在 py2app 生成的 dist 中包含通知,以便它可以在任何其他机器上工作。我的 setup.py 是
我的通知代码是:
在 eclipse 上,通知按预期发出,但是,导入错误会产生在行中:
但在终端这些行运行良好。