NSMenu items greyed/disabled for not apparent reason
We have similar code, and I removed the -setTarget
call and saw the disabled state.
As Willeke stated, it is because your object isn't in the responder chain.
So just make sure you explicitly set the target
property:
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"Start" action:@selector(startServer:) keyEquivalent:@""];
[item setTarget:self];
[menu addItem:item];