Reputation: 153
I am trying to fire up a notification to the Notification Center through node
and NodObjC
and
the problem is:
$.NSUserNotificationCenter('defaultUserNotificationCenter')
returns always null
instead of an object to be abled to call the deliverNotification
method ?
Does anyone has experience with NodObjC
?
Upvotes: 6
Views: 298
Reputation: 2012
I solved the issue by setting up a hook to provide the bundle id. Here is the demo code:
var $ = require('NodObjC');
$.import('Cocoa');
// hook the bundle id
($.NSBundle).getInstanceMethod('bundleIdentifier').setImplementation(function(value) {
return $('com.example.app1');
});
// test
var center = $.NSUserNotificationCenter('defaultUserNotificationCenter');
console.log(center); // output: <_NSConcreteUserNotificationCenter: 0x103821e90>
Upvotes: 0