views:

24

answers:

1

Compare...

NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:[performer methodSignatureForSelector:@selector(playFile:)]];
[invocation setSelector:@selector(playFile:)];
[invocation setTarget:performer];
NSString* string = [NSString stringWithString:@"reverse.wav"];
[invocation setArgument:&string atIndex:2];

...with...

NSInvocation* invocation = [[NSInvocation prepareWithTarget:performer] playFile:@"reverse.wav"];

. Why isn't such a method implemented?

+1  A: 

It just isn't, but there is no shortage of third-party implementations of the same functionality, such as the one written up at and created for Cocoa with Love.

Jeremy W. Sherman
So strange that it isn't there; I thought there'd be a reason. Great link!
andyvn22
@andyvn22: People just don't create NSInvocations all that much, so a nicer way to do it probably isn't very high on Apple's to-do list.
Chuck
Besides, we have blocks now. Finally :)
Mike Abdullah