3 Replies
      Latest reply on Jan 13, 2020 4:09 PM by goofyfooter
      pabugeater Level 1 Level 1 (0 points)

        After a few weeks of work my Objective-C Catalyst App is ready, except for the main menu, which I cannot change because I cannot seem to properly override buildMenuWithBuilder. This is the signature I am using, which seems like it should work:


        - (void)buildMenuWithBuilder:(id<UIMenuBuilder>)builder {
            NSLog(@"BUILD MENU=%@", builder);

        I conform to the <UIMenuBuilder> protocol. This code is in my UIApplicationDelegate subclass.  Any suggestions as to what I am missing?  Thanks.

        • Re: buildMenuWithBuilder
          pabugeater Level 1 Level 1 (0 points)

          Reply to self with solution.  This iPad app dates from day zero, hence the App Delegate declaration generated by Xcode way back then looks like this:

          @interface BlahAppDelegate : NSObject <UIApplicationDelegate, UIMenuBuilder>

          Looking at the Swift sample code I noted this:

          class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate

          I don't know Swift, but it looked to me like there was a difference in the superclass: old = NSObject, new = UIResponder.  After making my App Delegate a subclass of UIResponder buildMenuWithBuilder is now invoked.

            • Re: buildMenuWithBuilder
              diffent Level 1 Level 1 (0 points)

              this is a great observation, i was also wondering why everyone said to override buildMenuWithBuilder: in app delegate, when the app delegate documentation shows no such function to override.  buildMenuWithBuilder: was never called for me either.


              you found the answer:  very old iOS apps built from old Xcode starter templates have app delegate subclassed from NSObject, but that should be changed to subclass the app delegate from UIResponder now for Mac Catalyst menu operations:  old code commented out:


              @interface appDelegate : /*NSObject*/UIResponder <UIApplicationDelegate, UITabBarControllerDelegate> {


              tab bar controller stuff is optional of course depending on your app

              • Re: buildMenuWithBuilder
                goofyfooter Level 1 Level 1 (0 points)

                I spent several hours chasing this until I found this fix.  Thanks for the post.