nsusernotification

Remove application from Notification Center

寵の児 提交于 2019-12-28 09:08:47
问题 Hey I was playing around with making a small cocoa application and using the new Notification Center API in Mountain Lion. However my app is now present in the notification center settings, together with Calendar, Messages and so on. As it was just me playing around I want it to disappear from the list now, but I cannot find anyway to remove it, tried several things, dragging it out, holding alt+right click and so on. Does anyone know where the (probably a) plist that populates that list

Mac Mountain Lion send notification from CLI app

隐身守侯 提交于 2019-12-28 05:30:55
问题 How can I send a notification to the notification center from a command line app? My attemps so far compile and run, but don't succeed in notifying me. Example #import <Cocoa/Cocoa.h> int main(int argc, const char * argv[]) { NSLog(@"Running notifications"); NSUserNotification *note = [[NSUserNotification alloc] init]; [note setTitle:@"Test"]; [note setInformativeText:@"Woot"]; NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; [center

Swift - using timers/system clock/background threads to do something in my application every hour

坚强是说给别人听的谎言 提交于 2019-12-24 17:43:26
问题 I'm using: var alarm = NSUserNotification() var currentTime = NSDate() alarmTime = currentTime.dateByAddingTimeInterval(60) alarm.deliveryDate = alarmTime NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification(alarm) To get a notification that will fire an hour from the current time, the problem is I want the app to automatically set up another alarm after the first one finishes. NSTimer doesn't seem like it will work because once the app goes to the background it kills

How to update badge number when receive push notification

三世轮回 提交于 2019-12-24 08:28:13
问题 I need help finishing this piece of code so the app will show badge number when a push notification is received, I can receive push notification, but just no badge on app, here is the code func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) { if let aps = userInfo["aps"] as? NSDictionary, let _ = aps["alert"] as? String, let sound = aps["sound"] as?

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

Application icon in Notification Center is the default Mac icon

僤鯓⒐⒋嵵緔 提交于 2019-12-13 00:09:41
问题 I use another image.icns as my applications icon file. I've deleted ~/Library/Application Support/NotificationCenter/*.db and restarted my computer but the notification icon is still the default Mac icon for my application. 回答1: Turns out you should probably keep your icons in an " .iconset ". And have all the recommended sizes available for the notification center to pick up (e.g. might be 32 x 32, might be 16 x 16). And to create this, you can use the "Icon Composer" app to convert your

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

Using OS X 10.8 Notification Center (NSUserNotification) with Java

耗尽温柔 提交于 2019-12-10 15:58:06
问题 I'm struggling with the notification center in OS X 10.8. I wrote a wrapper to provide Java access to the NSUserNotification and NSUserNotificationCenter classes via JNA, however the functionality is limited. I am able to send a notification and it will display as long as the .jar is being run from an .app bundle via JavaApplicationStub. However, the line below is always logged to the console when the the notification style is set to "Alerts": 11/29/12 8:37:12.537 PM usernoted[162]: Failed to

Can an app use both alerts and banners in Notification Center?

五迷三道 提交于 2019-12-10 12:45:38
问题 I am creating a Mac OS X application to use Notification Center. Some notifications should remain on the screen until the user interacts with them, and others should disappear shortly after displaying. The NSUserNotificationAlertStyle key and changing System Preferences allow changing between banners and alerts. However, both approaches change all the notifications sent from my application. Can I send some notifications as alerts and others as banners? If so, how? 回答1:

IOS 10.2 UserNotifications problems on simple Alert and Badge

自古美人都是妖i 提交于 2019-12-07 01:24:24
问题 Before writing this post I made a lot of researches on UserNotification Framework, that substituted UILocalNotification in IOS 10. I also followed this tutorial to learn everything about this new feature : http://useyourloaf.com/blog/local-notifications-with-ios-10/. Today I'm encountering so much troubles to implement such trivial Notifications and since it's a recent new feature I couldn't find any solutions (especially in objective C)! I currently have 2 different notifications, one Alert