Search code examples
objective-ccocoansinvocation

Why is prepareWithInvocationTarget: specific to NSUndoManager?


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?


Solution

  • 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.