nsusernotification - NSUserNotificationCenter not showing notifications -


i'm not sure if got wrong examples find. wrote little helloworld.

#import <foundation/foundation.h> #import <foundation/nsusernotification.h>   int main (int argc, const char * argv[]) {     nsusernotification *usernotification = [[nsusernotification alloc] init];     usernotification.title = @"some title";     usernotification.informativetext = @"some text";      [[nsusernotificationcenter defaultusernotificationcenter] delivernotification:usernotification];      return 0; } 

i compile with:

cc -framework foundation -o app main.m 

it compiles , can execute won't show anything. reasons, nothing gets presented. read notifications may not displayed if application main actor. how can make show notification?

set delegate , overwrite

- (bool)usernotificationcenter:(nsusernotificationcenter *)center                                 shouldpresentnotification:(nsusernotification *)notification {   return yes; } 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -