NSInvalidArgumentException on menu access

I have one customer who reports that any attempt to drop down a menu causes this crash.
I don’t have a crash log yet, any ideas what might be causing it?
(Enable Menu Items event has an exception handler)

image

Unrecognized selector is usually a problem with a declare. Basically, declares take pointers to objects, but there’s no compile time verification possible, so you could end up passing in a pointer to an object that can’t handle the command you’re sending to it. In this case:

AccessibilityIsAttributeSettable:

Being sent to an NSMenuItem

If you go look at the docs for that method:

https://developer.apple.com/documentation/objectivec/nsobject/1529207-accessibilityisattributesettable/

You’ll see that it’s been deprecated since macOS 10.10. It’s entirely possible that it’s been removed in a recent version of macOS.

Interesting.
I don’t call it in a declare myself.
The customer has a 2022 M1 machine.

Ive also found that Christian may have a solution:

https://www.mbs-plugins.de/archive/2018-11-07/Fix_for_missing_accessibilityI/monkeybreadsoftware_blog_xojo

2 Likes

Maybe he has an older machine/os version?

He has a newer one than me.
I suspect this comes down to some accessibility setting in system preferences.
I added a call to InstallNSAccessibilityPatchMBS and gave them a new build, after which they report that the crash has gone.
Its a workaround… lucky I have the MBS plugins!

1 Like