Mac Mountain Lion sendet eine Benachrichtigung von der CLI-App
Wie kann ich eine Benachrichtigung von einer Befehlszeilen-App an das Benachrichtigungscenter senden? Meine bisherigen Versuche werden kompiliert und ausgeführt, aber es gelingt mir nicht, mich zu benachrichtigen.
Beispiel
#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 scheduleNotification: note];
return 0;
}
Ich kompiliere dann wie folgt:
clang -framework cocoa /tmp/Notes.m
und ich verstehe
2012-07-29 16:08:35.642 a.out[2430:707] Running notifications
als Ausgabe, aber keine Benachrichtigung :(
Ist das Codesignieren dabei ein Faktor?