When running the analyze in xcode 4.2 i have the warning “Value stored to ‘image’ during its initialization is never read.” Anyone can help me out what is wrong with the code?
UIImage *image=[[[UIImage alloc] init]autorelease];
if (carousel==recipeCarousel) {
image = [recipeItems objectAtIndex:index];
} else {
image = [packItems objectAtIndex:index];
}
UIView *view = [[[UIImageView alloc] initWithImage:image] autorelease];
return view;
Thank you.
You have alloc the UIImage with this code
but later you assign object in
recipeItemsorpackItemsso that you will lose your control to the allocated object.
So you can either do this
or