Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

-applicationDockMenu: method on NSApplicationDelegate doesn't work when attached to debugger

When I add a simple menu to the dock via the NSApplicationDelegate method -applicationDockMenu: and run the app from Xcode it doesn't work.

-(NSMenu*)applicationDockMenu:(NSApplication*)sender
{
    NSMenu *dockMenu = [self buildDockMenu];
    if (dockMenu != nil) 
     { 
          NSLog(@"Returning dock menu.");
          return dockMenu; 
     }
     else 
    {
         NSLog(@"Not ready to build dock menu");
         return nil;
    }
}

When I run the app, my main app window shows up but nothing logs out in -applicationDockMenu: until I click outside my app's window (so if I click the desktop background, or a Finder window, or whatever). Then after I click outside my app's main window this logs out:

Returning dock menu.

The "Not ready to build dock menu" message does not log out.

But...when I right click on the dock icon, the menu doesn't show up.

But if I stop the app from Xcode and just run it not attached to the debugger, the dock menu does show up. But this makes the debugging/testing situation not ideal.

I filed FB17554847

This is a known issue. Currently, we don't have any suggested workarounds.

Hello and thank you for filing a bug report. Your bug has been classified as a duplicate but the original bug about the same issue is currently open and under investigation. Duplicates count as that's an indicator of how many folks are affected by a specific problem.

-applicationDockMenu: method on NSApplicationDelegate doesn't work when attached to debugger
 
 
Q