-(void)invokeMethod
{
NSMethodSignature * sig = [[source class] instanceMethodSignatureForSelector:@selector(mySelector:)];
NSInvocation * invocation = [NSInvocation invocationWithMethodSignature:sig];
[invocation setTarget:myTarget];
[invocation setSelector:@selector(mySelector:)];
MySubClassOfNSInvocationOperation * command = [[[MySubClassOfNSInvocationOperation alloc] initWithInvocation:invocation] autorelease];
//setArgument retains command
[invocation setArgument:&command atIndex:2];
//addOperation retains command until the selector is finished executing
[operationQueue addOperation:command];
}
-(void)mySelector:(MySubClassOfNSInvocation*)command
{
//Do stuff
}
정확히 무슨 일이 일어나고 있는지 모르겠지만 NSInvocation
& MySubClassOfNSInvocationOperation
누수가 있습니다.이 메모리 누출을 어떻게 해결할 수 있습니까? NSInvocation
누수가 없으므로 통과와 관련된 문제점이 있습니다. 명령을 인수로 사용하십시오.
완벽. 감사 –