I have the following code (in a non-ARC project):
- (void)loadWithCompleteBlock:(void (^)(void))complete
{
...
complete = [complete copy];
...
[[NSOperationQueue mainQueue] addObserver:self forKeyPath:@"operationCount" options:0 context:complete];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *) context
{
void (^complete)(void) = context;
[self performSelectorInBackground:@selector(loadFilesWithCompleteBlock:) withObject:complete];
[complete release];
}
The static analyzer gives the warning Potential leak of an object stored into 'complete'
I tired to add NS_RELEASES_ARGUMENT
or CF_RELEASES_ARGUMENT
to the context
parameter, but nothing works.
Any ideas?