NSInvocation: unrecognized selector, although set

I get this message:

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

The main code I 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) on my own with these arguments ... so I'm not sure what I'm doing wrong.

+3
source share
1 answer

The answer is obvious, and it’s easy to skip reading type documentation too quickly. Arguments 0 and 1 are reserved, so I decided by setting indices 2 and 3

+3
source

Source: https://habr.com/ru/post/1790804/


All Articles