我不明白为什么当信息已经setSelector
通过.NSInvocation
invocationWithMethodSignature
要创建NSInvocation
对象,我们执行以下操作:
SEL someSelector;
NSMethodSignature *signature;
NSInvocation *invocation;
someSelector = @selector(sayHelloWithString:);
//Here we use the selector to create the signature
signature = [SomeObject instanceMethodSignatureForSelector:someSelector];
invocation = [NSInvocation invocationWithMethodSignature:signature];
//Here, we again set the same selector
[invocation setSelector:someSelector];
[invocation setTarget:someObjectInstance];
[invocation setArgument:@"Loving C" atIndex:2];
请注意,我们将选择器传递给[SomeObject instanceMethodSignatureForSelector: someSelector];
并再次传递给[invocation setSelector:someSelector];
.
有什么我想念的吗?