I recently discovered a pretty big performance issue in my app that was due to an image not being found in [UIImage imagenamed:].
I was wondering if there is a "drop-in" solution to have this kind of 'errors' logged in some way? I started writing an extension to the UIImage class, something like this:
@implementation UIImage (Debug)
#ifdef DEBUG
+ (UIImage*) imageNamed:(NSString*) name{
UIImage* img = [UIImage imageNamed:name];
if(!img){
NSLog(@"Error: referencing non-exiting image: %@", name);
}
return img;
}
#endif
@end
But this causes an endless loop since [UIImage imageNamed:name] of course causes the extension method to be called again...
Any suggestions?
thanks Thomas