I have a UiVIewController in which i have dragged a table view and put all the needed connections like delegate and data source and it works just fine, everything is great. I tried to set a background to this table view , and the i got this weird error
CUICatalog: Invalid asset name supplied: , or invalid scale factor: 2.000000
I tried to set the background using this method :
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mypredictions_bg.png"]];
[tempImageView setFrame:self.tableView.frame];
self.tableView.backgroundView = tempImageView;
What am i missing ? I checked the name of the picture is correct
I made a debug class which swizzles imageNamed so that you can get a debug trace on where this is happening.
You need to install JRSwizzle to use it.
https://github.com/rentzsch/jrswizzle
#import "UIImageDebugger.h"
#import "JRSwizzle.h"
@implementation UIImageDebugger
+ (void)startDebugging
{
static dispatch_once_t once;
dispatch_once(&once, ^{
NSError *error=NULL;
[UIImage jr_swizzleClassMethod:@selector(imageNamed:)
withClassMethod:@selector(hs_xxz_imageNamed:)
error:&error];
if (error)
{
NSLog(@"error setting up UIImageDebugger : %@",error);
}
else
{
NSLog(@"!!!!!!!!!!!!!!!!!!!! UIImage swizzle in effect - take this out for release!!");
}
});
}
@end
@interface UIImage (UIViewDebugger)
+ (UIImage*)hs_xxz_imageNamed:(NSString *)name;
@end
@implementation UIImage (UIViewDebugger)
+ (UIImage*)hs_xxz_imageNamed:(NSString *)name
{
if (!name)
{
NSLog(@"null image name at \n%@",[NSThread callStackSymbols]);
}
UIImage *image=[self hs_xxz_imageNamed:name];
if (!image)
{
NSLog(@"failed to make image at \n%@",[NSThread callStackSymbols]);
}
return image;
}
@end
In My case I made category for UIImageView and UITextfied, In That, sometimes I don't need an image, that time I supplied @"" (i.e. Null string), it occurs problem, after some R&D I supply just "nil" instead of @"", it solves my warning, so maybe this type of warning occurs while not get proper image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With