"Can't find image named XXX on watch" when I use cache image
I am using an - (BOOL)addCachedImage:(UIImage *)image name:(NSString *)name
API WKInterfaceDevice
to store images.
The problem is that most of the time when I try to use these cached images using setImageNamed:
on WKInterfaceImage
I get this error Unable to find image named XXX on watch
which results in a blank image on the screen. I insist that this does NOT happen all the time.
This happens on both the simulator and the device.
source to share
Go to Assets.xcassets
in the Project Navigator on the left sidebar in Xcode.
Select the image that was 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 fit in one place, but Apple Watches seems to require at least 2x resolution. Just optimize your images and everything will work seamlessly.
source to share
Looks like an Xcode bug, I ran into this issue in Xcode 7 beta 4, but not in beta 2. I researched and experimented with many things, including various suggestions, and it turns out that if images are set to Universal they are not ( http : //iphone.tagsstack.com/unable_to_find_image_named_ldquo_xxrdquo_on_iwatch_error ). However, if you select them separately for each watch size, they will appear and the problem will be solved.
source to share