TooTallNate / NodObjC

The Node.js ⇆ Objective-C bridge

Home Page:http://tootallnate.github.io/NodObjC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Passing callback to DARegisterDiskAppearedCallback

javihernandez opened this issue · comments

Hi,

I'm trying to write a program that keeps track of disks add/remove events, so I can trigger an action on my side. In fact, this is the objective-c version of it.

The problem is that I'm getting a TypeError: error setting argument 3 - writePointer: Buffer instance expected as third argument when passing my callback to DADiskRegisterDiskAppearedCallback.

Here's a portion of my code

var $ = require("nodobjc");

$.import('Foundation')
$.import('DiskArbitration')

function cb (disks, context) {
    console.log('# at cb');
};

var session = $.DASessionCreate($.kCFAllocatorDefault);
$.DARegisterDiskAppearedCallback(session, $.kDADiskDescriptionMatchVolumeMountable, cb, 0);

Am I missing something?

Thanks in advance,
Javi