I think we have to deal with the mysterious disappearance of setAppleMenu in OSX 10.4*
Could any kind person with 10.4 please compile/run the attached project and tell me what happens (it may complain that setAppleMenu is missing). There should be one menu called 'MenuTest' with a submenu that says 'Quit me.' Try commenting out line 12 in MyApp.m (#define USE_SET_APPLE_MENU) - what happens now?
On my 10.2 system, if I don't call it, I get an empty menu called MenuTest, then a menu called Menu with the Quit me! submenu.
I haven't been able to find out how nib files designate the App menu, it's a binary file.
Pete
Good job we didn't start re-writing all the blit code in PowerPC assembly
OS X 10.4.1
There should be one menu called 'MenuTest' with a submenu that says 'Quit me.'
Yes.
Try commenting out line 12 in MyApp.m (#define USE_SET_APPLE_MENU) - what happens now?
Two menus:
"MenuTest" (in bold) with no submenus.
"Menu" with the "Quit me" submenu
Did you get the warning message when compiling?
It looks as if NSApplication does respond to setAppleMenu:, but they took it out of the header file and purged it from the docs, for reasons unknown. It may have been an error, since obsolete functions are usually listed as deprecated before they disappear entirely.
I can produce a patch which will stop the warning appearing in 10.4, and submit it to [AD] for scrutiny.
Pete
See attached screenshot for warnings.
I had a really good idea: use an Objective-C feature called a 'category' which allows you to add methods into library code, even without source. I would add the interface part but no implementation; this would suppress the warning, but the app would still pick up the proper implementation when it ran.
Imagine my surprise when I looked in AppKit/NSApplication.h to find the correct signature for setAppleMenu, and found that Apple had done the exact same thing. Here's the code I found:
@interface NSApplication(NSAppleMenu) - (void)setAppleMenu:(NSMenu *)menu; @end
So, as one last favour, can you paste the following lines into MyApp.m, just after the #define (which should be retained)
@interface NSApplication(AllegroOSX) - (void)setAppleMenu:(NSMenu *)menu; @end
and see if this gets rid of the warning message (I noticed in your screen shot that XCode had sorted the individual lines of the warning message alphabetically. Who thought up that great idea?
)
Thanks a lot,
Pete
That took care of all the warnings.