I am creating a menu programmatically:
+ (void)refreshStatusMenu {
for (NSDictionary *dict in kbMsgSet) {
NSString *msj = [dict objectForKey:@"msj"];
NSString *mid = [dict objectForKey:@"mid"]; // <- this would be http://www.blah.com
msg_item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@", msj] action:@selector(goToURL:mid:) keyEquivalent:@""];
[msg_item setTarget:[self class]];
[sm insertItem:msg_item atIndex:(i_msg)];
i_msg++;
//...
}
}
How do I pass a parameter to @selector(goToURL:)
, so that on item-click I could call:
+ (void)goToURL:(id)obj {
NSLog(@"Open url:...%@", obj);
}
If I try passing @selector(goToURL:var2:)
I get uncaught exception error.