Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unexpected token 'o'" in type-encodings.js #36

Open
chrillek opened this issue Feb 16, 2022 · 0 comments
Open

"Unexpected token 'o'" in type-encodings.js #36

chrillek opened this issue Feb 16, 2022 · 0 comments

Comments

@chrillek
Copy link

This code

'use strict';
const objc = require('objc');

const {
  NSURL,
  NSURLTypeIdentifierKey
} = objc;

const uti = objc.allocRef();
const error = objc.allocRef();
const fileURL = NSURL.fileURLWithPath('/Users/ck');
fileURL.getResourceValue_forKey_error(uti, NSURLTypeIdentifierKey, error);

throws this error:

Node.js v17.5.0

…/node_modules/objc/src/type-encodings.js:175
          throw new Error(`Unexpected token ${this.currentToken}`);
          ^

Error: Unexpected token o
    at TypeEncodingParser.parseType (…/node_modules/objc/src/type-encodings.js:175:17)
    at TypeEncodingParser.parse (…/node_modules/objc/src/type-encodings.js:125:23)
    at coerceType (…/node_modules/objc/src/type-encodings.js:258:28)
    at …node_modules/objc/src/instance.js:63:14
    at Array.map (<anonymous>)
    at Instance.call (…/node_modules/objc/src/instance.js:62:72)
    at Object.apply (…/node_modules/objc/src/proxies.js:27:19)
    at Object.<anonymous> (…/testcase.js:12:9)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1151:10)

I think that the call to getResourceValue_forKey_error should be ok, but may of course be wrong. In that case, what should I change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant