It looks like you're trying to make an anonymous funtion. AFAIK, Obj-C has no support for these. Basically want you want to do is define action
as a proper method:
[item setAction:@selector(action:)];
…
-(void)action:(id)sender{
[window makeKeyAndOrderFront:self];
}
Also, I'm not sure why you're passing NSApp
to makeKeyAndOrderFront:
. The full signature is - (void)makeKeyAndOrderFront:(id)sender
, so passing self
is usually most appropriate (although I'm not even sure what that input does!).
I suggest you work through a few tutorials to familiarize yourself with Obj-C and Cocoa.