NSInvocation: unrecognized selector though it is set

1.1k views Asked by At

I'm getting this message:

"(null): unrecognized selector sent to class 0x3f52e824"

The basic code I've tried:

SEL sel = @selector(applyProperties:toObject:);

NSInvocation* inv = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:sel]];
[inv setTarget:self];
[inv setSelector:sel];
[inv setArgument:params atIndex:0];
[inv setArgument:theObject atIndex:1];

NSOperationQueue* queue = [[NSOperationQueue alloc] init];
NSInvocationOperation* operation = [[NSInvocationOperation alloc] initWithInvocation:inv];
[queue addOperation:operation];

 [queue release];

I can call (applyProperties:toObject) by itself with these arguments... so I'm not sure what I'm doing wrong.

1

There are 1 answers

0
michael On BEST ANSWER

The answer is obvious, and was easy to miss in the documentation by vice of reading too quickly. Arguments 0 and 1 are reserved, so I solved by setting to indexes 2 and 3