Have a look at the thread titled 'Mapping Selector as return value' dating from 29. Mai 2009. It discusses the same issue and a possible workaround.
On 16.01.2010, at 14:12, Harald Kuhr wrote:
I'm hacking again. :-)
And as usual, I'm running into issues I don't understand. I'm tying to modify the standard application menu (and having great success with that). But, the action of an NSMenuItem is always returned as "undefined selector". This happens wether or not I explicitly set the action to a Selector created by Foundation.selector or just try to get the default one. If I replace the target (with a non-conforming object), I'll get an exception that will tell me the correct name of the selector. Is there a bug in Rococoa here?
The NSMenuItem action method is defined as
and setAction as
My definitions are:
pubilc abstract Selector action();
public abstract void setAction(Selector s);
The problem is now that for example
will make the application crash if that menu item is selected, while it should (effectively) be a no-op, making the menu item do exactly the same as before...