I know this was posted about years and years ago. Its probably been a decade or more since this was last written about.
But I ran into it again and had to say to myself “Oh right you cant do this this way because the App method will return nil at this point”
The situation is I wanted to put a custom menu item subclass into the menu bar. This works. You can add the item and change its super and all your constructors etc will get called. But if you need to refer to “the application” then there are times when it will NOT work. Like if the item you added is part of the default menu bar created when the application starts up.
At that point the global App method can and may return NIL because the default menubar is created BEFORE the application singleton is registered in a way the App method can return it.
So IF you need to do something like this and need to refer to “App” then you may need a flag that delays this initialization until some time after the app has started up and you CAN get a valid reference to the singleton.
Heads up !