开发者

NSInvocation: unrecognized selector though it is set

I'm getting this message:

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

The basic code I've tried:

SEL sel = @selector(applyProperties:to开发者_如何学JAVAObject:);

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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜