I'm trying to use ObjC with JXA. Here is a simplest possible example:
ObjC.import('Foundation')
str = $.NSString.alloc.initWithUTF8String('foo')
console.log(str)
This code gives me an Error: TypeError: undefined is not an object (evaluating '$.NSString.alloc')
.
The same happens if I remove the 'import' line (as far as I understand symbols from the Foundation framework are available by default in JavaScript for Automation).
Why this happens?
Update: I'm using Big Sur (beta 2). Looks like something is broken in JXA<->ObjC bridge.
Thanks!