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)


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:


Being sent to an NSMenuItem

If you go look at the docs for that method:


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.

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:



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