I am trying to perform a method in a background thread using a NSOperationQueue like so:
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(method)
object:nil];
[queue addOperation:operation];
[queue release];
[operation release];
The problem is that, analyzer says that there is a leak that is stored into queue.
How can I fix this?
Calling [MyClass new] is the same as calling [[MyClass alloc] init], it return object with retainCount = 1.
So, it should be released after.