NSMenuDelegate methods not called for contextual menu <p>I have a Document based application. I want to add a contextual menu that displays context-sensitive info when the user right-clicks selected text in an NSTextView.</p> <p>I have followed the advice in the <a href="http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/MenuList/Articles/DisplayContextMenu.html#//apple_ref/doc/uid/TP40004968-SW1" rel="nofollow">Apple documentation</a> and </p> <ul> <li>Added an NSMenu as a root object in my XIB file.</li> <li>Connected the NSMenu instance to the <code>menu</code> outlet of the NSTextView.</li> <li>Connected an IBAction to the NSMenuItem inside the NSMenu.</li> </ul> <p>So far so good. Every thing works as expected: the menu item appears and the action is called when it is selected. </p> <p>I need to get the selected text from the NSTextView before the menu appears so that I can configure my menu item appropriately. According to the docs</p> <blockquote> <p>If you need to customize the contextual menu, you can do so by setting an appropriate object as the menu’s delegate and implementing the menuWillOpen: method to customize the menu as you see fit just before it appears.</p> </blockquote> <p>I connect the delegate of the NSMenu to File's Owner. None of the delegate methods are called. ( <code>menuWillOpen:</code> is the only one I need, but I've tried others, too).</p> <p>I set a breakpoint inside the IBAction that gets called when the menu item is selected. If I inspect the menu with the debugger I can see that the delegate is correctly set to the object that implements the delegate method.</p> <p>Is there anything else to check? Anything I'm doing blatantly wrong?</p> <p>Xcode v4.6.3<br /> SDK v10.8<br /> Deployment target 10.7</p>