6

I am using xib to make UI of one of my apps. I am getting several warnings in console related to "CUICatalog: Invalid asset name supplied: (null)". From research I got to know that if we supply wrong image name in xib this error occurs. But here I want to know if there is any way to point the place from where its throwing that error, xib name or wrong image name etc.

sanjana
  • 2,974
  • 2
  • 23
  • 30

2 Answers2

1

I have just fixed this error. Just Check the usage of function [UIImage imageNamed:(NSString*) imageName]. If the imageName is nil, then error happens.

In my code:

UIImageView*imageView=[[UIImageView alloc]initWithFrame:frame];

    if (imageName!=nil) {
        imageView.image=[UIImage imageNamed:imageName];
    }
passwind
  • 139
  • 5
0

This error occurs when you call UIImage(named: String) with empty string. You can use this static method where you check name for emptiness.

static func create(_ name: String) -> UIImage? {
    guard !name.isEmpty else { return nil }
    return UIImage(named: name)
}