I have this code:
imageNumber++;
UIImage *image = [[UIImage alloc]init];
image = [UIImage imageNamed:[NSString stringWithFormat:@"l%d_s%d.png", currentSet, imageNumber]];
[imageToColor setImage:image]; //<-- here it crash
[image release];
so, after a few minuted my app crash with this message
[UIImage isKindOfClass:]: message sent to deallocated instance
why?? can you help me?
The problem with your code is that you allocate a
UIImageobject on image variable and then without releasing it you set it to another autoreleased object.[UIImage imageNamed:]returns an autoreleasedUIImageobject.