Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 584 Vote(s) - 3.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: CUICatalog: Invalid asset name supplied: (null), or invalid scale factor : 2.000000

#1
TableViewApplication[1458:70b] CUICatalog: Invalid asset name supplied: (null), or invalid scale factor: 2.000000

[![Screenshot added][1]][1]

Getting this warning while working with TableViewController. How to rectify this error and which block is affected?


[1]:
Reply

#2
Since the error is complaining that the name you gave is `(null)`, this is most likely caused by calling `[UIImage imageNamed:nil]`. Or more specifically, passing in a variable hasn't been set, so it's equal to `nil`. While using `stringWithFormat:` would get rid of the error, I think there's a good chance it's not actually doing what you want. If the name you supply is a `nil` value, then using stringWithFormat: would result in it looking for an image that is literally named "(null)", as if you were calling `[UIImage imageNamed:@"(null)"]`.

Something like this is probably a better option:

if (name) {
UIImage *image = [UIImage imageNamed:name];
} else {
// Do something else
}

You might want to set a breakpoint in Xcode on that "Do something else" line, to help you figure out why this code is getting called with a nil value in the first place.
Reply

#3
This error (usually) happens when you try to load an image with `[UIImage imageNamed:myImage]` but iOS is not sure if `myImage` is really a `NSString` and then you have this warning.

You can fix this using:

[UIImage imageNamed:[NSString stringWithFormat:@"%@", myImage]]

Or you can simply check for the `length` of the name of the `UIImage`:

if (myImage && [myImage length]) {

[UIImage imageNamed:myImage];
}
Reply

#4
I have just fixed this error. Just check the usage of the `[UIImage imageNamed:(NSString*) imageName]` function. If the `imageName` is `nil`, then error occurs.
Reply

#5
In my case i was passing [UIImage imageNamed:@""] which caused me to show the warning. Just add breakpoints to all the lines where you have used imageNamed and the debug the line where you find the warning.
Reply

#6
In Xcode 6.4, this seems to occur when using "Selected Image" for a tab bar item in the storyboard, even if it's a valid image.

[![enter image description here][1]][2]

This doesn't actually seem to set the selected state image anyway, so it needs to be defined in User Defined Runtime Attributes, and removed from the SelectedImage attribute of the Tab Bar Item

[![enter image description here][3]][3]


[1]:

[2]:

[3]:
Reply

#7
The Reason to the error is passing a nil value to the "imageNamed:" method. To avoid this, you can hide your imageView when you try to pass the nil value. The chances may occur in reusing the imageViews in UITableView or may be in scrollViews.

I avoided the warning with the below check :

UIImageView *your_image_view;
NSString *imageName;
if(imageName && imageName.length){
your_image_view.hidden = NO;
your_image_view.image = [UIImage imageNamed:imageName];
}
else {
your_image_view.hidden = YES;
}
Reply

#8
I got this warning when I load image use `[[UIImage imageNamed:normalStr] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]`, than, I change to `[UIImage imageNamed:normalStr]`, warning was gone.
Reply

#9
One approach is do class method swizzling to replace `[UIImage imageNamed:]` with your own implementation, then check the image name in your implementation. See the following:

[To see links please register here]


I implemented this in my UIImage(Debug) category:

+ (UIImage *)db_imageNamed:(NSString *)imageName {
if ([imageName length] == 0) {
NSLog(@"breakpoint here");
}
return [self db_imageNamed:imageName]; // not a recursive call here after swizzling
}

You might want to swizzle `[UIImage imageNamed:inBundle:compatibleWithTraitCollection:]` as well.
Reply

#10
You are supplying some invalid image name, so need to validate before putting it you can do any of the above ways whichever make sense for your code or like

if (iconImageName && [iconImageName length])
{

[UIImage imageNamed:iconImageName];
}
else
{
iconImageName.hidden = YES;
}

Hope it will help!!!!

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through