From 3ce551119129eb33d57ef8c612d1f4df93b0fa26 Mon Sep 17 00:00:00 2001 From: Gabriel Handford Date: Mon, 16 May 2016 15:16:21 -0700 Subject: Write to stdout instead of using NSLog --- notifier_darwin.m | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'notifier_darwin.m') diff --git a/notifier_darwin.m b/notifier_darwin.m index 1baf885..0933042 100644 --- a/notifier_darwin.m +++ b/notifier_darwin.m @@ -100,10 +100,8 @@ CFStringRef deliverNotification(CFStringRef titleRef, CFStringRef subtitleRef, C }); } -- (NSString *)JSON:(NSDictionary *)dict { - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:0 error:nil]; - if (!jsonData) return @""; - return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; +- (NSData *)JSONData:(NSDictionary *)dict { + return [NSJSONSerialization dataWithJSONObject:dict options:0 error:nil]; } - (void)userNotificationCenter:(NSUserNotificationCenter *)center didDeliverNotification:(NSUserNotification *)userNotification { @@ -136,7 +134,7 @@ CFStringRef deliverNotification(CFStringRef titleRef, CFStringRef subtitleRef, C } else { action = userNotification.actionButtonTitle; } - NSLog(@"%@", [self JSON:@{@"action": action}]); + [[NSFileHandle fileHandleWithStandardOutput] writeData:[self JSONData:@{@"action": action}]]; break; } case NSUserNotificationActivationTypeContentsClicked: -- cgit v1.2.3