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
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.
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:
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.
Maybe you can use this to confirm the "imageName" is not a "nil";Then you will leave away this warning.
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
Hope it will help!!!!
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.
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:How to swizzle a class method on iOS?
I implemented this in my UIImage(Debug) category:
You might want to swizzle
[UIImage imageNamed:inBundle:compatibleWithTraitCollection:]
as well.I have just fixed this error. Just check the usage of the
[UIImage imageNamed:(NSString*) imageName]
function. If theimageName
isnil
, then error occurs.This one appears when someone is trying to put
nil
in[UIImage imageNamed:]
Add symbolic breakpoint for
[UIImage imageNamed:]
Add
$arg3 == nil
condition on Simulator,$r0 == nil
condition on 32-bit iPhone, or$x2 == nil
on 64-bit iPhone.Run your application and see where debugger will stop.
P.S. Keep in mind this also happens if image name is empty string. You can check this by adding
[(NSString*)$x2 length] == 0
to the condition.