JXA-Cookbook icon indicating copy to clipboard operation
JXA-Cookbook copied to clipboard

NSInvalidArgumentException: NSGetSizeAndAlignment(): unsupported type encoding spec 'G' at 'GPoint}"size"{CGSize}}' in '{CGPoint}"size"{CGSize}}'

Open michaelblight opened this issue 5 years ago • 7 comments
trafficstars

I'm trying to create a quick action that will resize images based on pixel sizes I enter. The code I'm using at some point needs a CGRect, but whenever I create one, Automator exits immediately. A minimal example is:

ObjC.import('Cocoa')

function run(input, parameters) {
	const rect = $.CGRectMake(0, 0, 200, 200);
	return input;
}

When I run this, Automator exits. Any idea why? I get the same thing with NSMakeRect. In my actual usage I have debugger before and after, so I know it's on this statement. I'm getting the following in the crash report:

Application Specific Information:
dyld3 mode
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'NSGetSizeAndAlignment(): unsupported type encoding spec 'G' at 'GPoint}"size"{CGSize}}' in '{CGPoint}"size"{CGSize}}''
terminating with uncaught exception of type NSException
abort() called

Since this looks like a bug, I've submitted feedback to Apple.

Great resource by the way, much better than anything Apple has provided, despite being a bit old now.

michaelblight avatar Sep 10 '20 13:09 michaelblight

If you can, update to Big Sur and see if it is fixed there.

Tatsh avatar Sep 10 '20 22:09 Tatsh

Unfortunately it's my only laptop, and we're under stage 4 restrictions, so I'm currently pretty dependent on it. I'm reaching out to others I know to see if they can.

michaelblight avatar Sep 11 '20 01:09 michaelblight

This is an ongoing issue so I will keep this open. I don't know what is going to happen when Big Sur is finally released.

Tatsh avatar Oct 29 '20 02:10 Tatsh

Still occurring on macOS 10.15.7. So lame. 😒

Tatsh avatar Nov 07 '20 06:11 Tatsh

Still occurring on Big Sur.

Tatsh avatar Nov 14 '20 15:11 Tatsh

#44

wadimw avatar Jun 09 '21 09:06 wadimw

This works now on Monterey.

Tatsh avatar Nov 22 '21 16:11 Tatsh