LSRegisterUrl 'Buffer instance expected as third argument'
unilynx opened this issue · comments
Arnold Hendriks commented
I'm stuck trying to invoke LSRegisterUrl - whatever arguments I provide, I'm always getting back a "Buffer instance expected as third argument"
My code:
var NodObjC = require('nodobjc');
NodObjC.import('Foundation');
NodObjC.import('CoreServices');
var urlref = NodObjC.NSURL('URLWithString', NodObjC('/tmp/testfile'));
//trying to invoke https://developer.apple.com/library/mac/documentation/Carbon/Reference/LaunchServicesReference/#//apple_ref/c/func/LSRegisterURL
var res = NodObjC.LSRegisterURL('inURL', urlref, 'inUpdate', true);
console.log(res);
Result:
/Users/arnold/projects/register-protocol-handler-osx/node_modules/ffi/lib/_foreign_function.js:55
throw e
^
TypeError: error setting argument 0 - writePointer: Buffer instance expected as third argument
at TypeError (native)
at Object.writePointer (/Users/arnold/projects/register-protocol-handler-osx/node_modules/ref/lib/ref.js:742:11)
at Object.set (/Users/arnold/projects/register-protocol-handler-osx/node_modules/ref/lib/ref.js:484:13)
at Object.alloc (/Users/arnold/projects/register-protocol-handler-osx/node_modules/ref/lib/ref.js:516:13)
at ForeignFunction.proxy (/Users/arnold/projects/register-protocol-handler-osx/node_modules/ffi/lib/_foreign_function.js:50:22)
at Function.unwrapper (/Users/arnold/projects/register-protocol-handler-osx/node_modules/nodobjc/lib/core.js:301:31)
at Object.<anonymous> (/Users/arnold/projects/register-protocol-handler-osx/failed.js:7:19)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
Lukas Kollmer commented
@unilynx I'm having the same problem w/ -[CNContactStore unifiedContactsMatchingPredicate:keysToFetch:error:]
. Did you find a solution to this?
Arnold Hendriks commented
No. For the given project, I gave up on using a protocol handler and switched to using https with a localhost port, and an always-running service listening on that port