I’m a beginner and i found this warning here after running ‘Analyze’ on Xcode:
IphoneFeatureImageDetailViewController *img = [[IphoneFeatureImageDetailViewController alloc] initWithNibName:@"IphoneFeatureImageDetailViewController" bundle:nil];
img.imagesArray = [heroArray copy];
img.index = imgButton.tag; // AT THIS LINE IT SAYS POTENTIAL MEMORY LEAK
[self.navigationController pushViewController:img animated:YES];
[img release];
Please point me in right direction!
The Analyze command often flags the line after the problem because that’s the point in the code where it knows the leak has happened. In your case, it’s probably the
imagesArraythat it’s reporting. If that’s aretainproperty then there will be one retain for thecopyand another for the assignment, which is more than needed.I suspect…
…will clear it up. Or you could switch to ARC and the whole problem would go away. 🙂