Search code examples
iosmac-catalystuimenubuilder

UIMenuBuilder not called (Catalyst)


I have an iOS app (create feb 2019) which is now also available for MacOS by using Mac Catalyst. The app works fine. I added menu functionality to the File menu with

override func validate(_ command: UICommand) {
}

Now I want to remove the Help menu. For this I used, buildmenu in AppDelegate.

override func buildMenu(with builder: UIMenuBuilder) 
{
  super.buildMenu(with: builder)
  builder.remove(menu: .help)
}

In a newer app (Dec 2019) for Catalyst this works fine, and the code removes the menu. In my older app, buildMenu is not called.

AppDelegate is setup as a UIResponder...

I have no idea how to make this work. Any idea what I can try?

Best regards.


Solution

  • Turns out it was my mistake. Once you add a Menu (UiMenuRoot) to the project, you can not use UIMenubuilder to modify the menu.