Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unable to find image named XXX on watch" when I use image cache

I use - (BOOL)addCachedImage:(UIImage *)image name:(NSString *)name API of WKInterfaceDevice to store images.

The issue is that most of the time, when I try to use those cached image by using setImageNamed: on WKInterfaceImage, I get this Unable to find image named XXX on watch error that results in an empty image on screen. I insist on the fact that this does NOT happen all the time.

This occurs both on simulator and on device.

like image 525
Aurelien Porte Avatar asked Jan 18 '26 02:01

Aurelien Porte


2 Answers

Go to Assets.xcassets in the Project Navigator on the left sidebar in XCode.

There choose the image that is not found.

For me it worked as soon as I had the image placed in the "2x" placeholder.

If you just import the images they are placed in the 1x spot, but the Apple Watches seem to need at least the 2x resolution. Just optimize your images and it will all work seamlessly.

like image 81
Andreas Plüss Avatar answered Jan 19 '26 20:01

Andreas Plüss


I figured out that image names that are too long (character count > 255) lead to the bug. As soon as the image name used to cache the image is shorter, I don't get the error anymore.

like image 22
Aurelien Porte Avatar answered Jan 19 '26 20:01

Aurelien Porte



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!