nsusernotificationcenter

Display banner for NSUserNotification while app is frontmost

无人久伴 提交于 2021-01-28 07:45:47
问题 I want to display user notifications while the app is frontmost. I found the code below, but I'm not sure how to use the delegate: it seems to just return a boolean value. class MyNotificationDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate { func applicationDidFinishLaunching(aNotification: NSNotification) { NSUserNotificationCenter.defaultUserNotificationCenter().delegate = self } func userNotificationCenter(center: NSUserNotificationCenter,

Swift NSUserNotification doesn't show while app is active

我是研究僧i 提交于 2019-12-23 20:42:00
问题 I am new to OSX development and I am making an app which fires a notification when something happens. But it isn't showing the notification when the app is the key app, as it is the default behavior. I want to show them even when the app IS the key app. However I only found solutions to this matter that were written in objective-c but right now I am working with Swift. I was wondering how I could I implement it with Swift. 回答1: To ensure the notifications are always shown you'll need to set a

how to include NSUserNotificationCenter in py2app

有些话、适合烂在心里 提交于 2019-12-10 17:29:05
问题 I am making an app in python 2.7 on mac osx 10.8.5 I want to show notification number of times, therefore using NSUserNotificationCenter . Notifications are coming while running code on eclipse. But, the issue is when I made app using py2app, Notifications are not coming . Moreover, the default page of error of open console and Terminate is coming. Please suggest some way, how to include Notification in dist generated by py2app, so that It will work on any other machine. My setup.py is from

NSUserNotificationCenter.defaultUserNotificationCenter() returns None in python

纵饮孤独 提交于 2019-12-10 15:10:44
问题 I am trying to connect to the Mountain Lion notification center via python. I've installed pyobjc and am following the instructions here and here. Also see: Working with Mountain Lion's Notification Center using PyObjC Here's my code: import Foundation, objc import AppKit import sys NSUserNotification = objc.lookUpClass('NSUserNotification') NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter') def notify(title, subtitle, info_text, delay=0, sound=False, userInfo={}): """

Is there any way of knowing how many NSUserNotifications there are in NSUserNotificationCenter?

ぃ、小莉子 提交于 2019-12-06 08:42:44
问题 Is there any non-private way of knowing how many notifications there are in the Notification Center ( NSUserNotificationCenter ) in Mountain Lion? Not just notifications from my app, but from all apps. So, to sum things up, what I want to do is to retrieve the number of notifications displayed here: I've tried to search around, but I can't find information about this. Any ideas? Thanks in advance! 回答1: There is no public API to access notifications from other apps. The best way to access this

show NSUserNotification additionalActions on click

无人久伴 提交于 2019-12-05 01:30:05
问题 In the image above you can see two notifications on OS X. The first one is from my app and the second is from Apple's Reminders.app. In the image you can see the otherButtonTitle 'Complete' and the actionButtonTitle 'Later'. The second notification, i.e. the one from Reminders.app behaves quite differently. It gets this little arrow pointing downwards on mouse over indicating that there are more actions when clicked. And indeed, you just need to click once on 'Later' and it will give you a

Is there any way of knowing how many NSUserNotifications there are in NSUserNotificationCenter?

走远了吗. 提交于 2019-12-04 13:37:12
Is there any non-private way of knowing how many notifications there are in the Notification Center ( NSUserNotificationCenter ) in Mountain Lion? Not just notifications from my app, but from all apps. So, to sum things up, what I want to do is to retrieve the number of notifications displayed here: I've tried to search around, but I can't find information about this. Any ideas? Thanks in advance! There is no public API to access notifications from other apps. The best way to access this information is to read the sqlite database located in ~/Library/Application Support/NotificationCenter/

UILocalNotification always shows up as soon as I load my app regardless of the fire date

*爱你&永不变心* 提交于 2019-12-03 18:06:13
问题 Hello I am new to swift and IOS programming. I have set up 6 notifications that are supposed to alert the user 6 times a day depending on the time of day. The alerts are working but for some reason when the app first launches all 6 alerts show up in the notification center at the same time. Any help will be greatly appreciated. this is the code in the AppDelegate.swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { /

show NSUserNotification additionalActions on click

倾然丶 夕夏残阳落幕 提交于 2019-12-03 15:17:04
In the image above you can see two notifications on OS X. The first one is from my app and the second is from Apple's Reminders.app. In the image you can see the otherButtonTitle 'Complete' and the actionButtonTitle 'Later'. The second notification, i.e. the one from Reminders.app behaves quite differently. It gets this little arrow pointing downwards on mouse over indicating that there are more actions when clicked. And indeed, you just need to click once on 'Later' and it will give you a couple more options to choose from. However, I can't get the same behavior to work for my notification. I

Mac OS X NSUserNotificationCenter notification get dismiss event/callback

浪尽此生 提交于 2019-11-30 08:32:46
In our app we are displaying Notification Center notifications in alert style. Displaying notification works fine, as well as we get callback when user interacts with the notification either by clicking on notification or by clicking on Action button. However, we are interested in getting a callback or event when user clicks on Other button in notification. I have seen MAC OS does this when it displays its updates available dialog. Refer to this image for clarification about OS X update available alert: I have searched this over the internet, as well as gone through Notification Center's