Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUICatalog: Invalid asset name supplied: , or invalid scale factor: 2.000000

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

like image 315
Elias Rahme Avatar asked Apr 24 '14 06:04

Elias Rahme


2 Answers

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
like image 100
Confused Vorlon Avatar answered Oct 21 '22 06:10

Confused Vorlon


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.

like image 29
g212gs Avatar answered Oct 21 '22 05:10

g212gs