In my application I m using following code below:-
NSArray* toolbarItems = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)], nil];
[toolbarItems makeObjectsPerformSelector:@selector(release)];
For that it shows Potential leak of an object .
Yes that’s a potential leak because you created a
UIBarButtonItemthat you owned (since you invokedalloc), but lost the reference to it by directly putting it into the array. As such, the analyzer is reporting that you leaked it.Besides that, the code is terrible. I can’t think of any valid situation where you’d ever want to do
[anArray makeObjectsPerformSelector:@selector(release)];