その情報が既に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];
。
足りないものはありますか?