I'm new to Obj-C/Cocoa programming, and I'm having an issue trying to dynamically add menu items to an NSMenu instance and have the items action selector already set upon insertion.
I can, add the dynamic menu items fine, but the action selector doesn't trigger when the item is clicked via the menu.
The first line below is the line of code I am using to add the menu item. You can set I'm setting the action:(SEL)aSelector to the "openEchowavesURL" function.
This function is in the same controller class file and I've included the function definition below.
Am I just calling the wrong selector syntax or someting? Or what is the trick to get the menu item to call a selector when clicked?
[statusMenu insertItemWithTitle:[NSString stringWithFormat:@"%d - %@", convo.newMessagesCount, convo.ewName] action:@selector(openEchowavesURL:) keyEquivalent:@"" atIndex:0];
- (void)openEchowavesURL:(id)sender {
// function details here
}