10

Problem:

Trying to set the WKInterfaceLabel text using xCode 6.2 but it returns this error:

WatchKit Extension[4608:145616] Unable to find image named "hello" on Watch

Code:

@IBOutlet var lblPassword: WKInterfaceLabel!

lblPassword.setText("hello")
user1872384
  • 6,886
  • 11
  • 61
  • 103
  • Error is saying that you are using image named "hello" and the code you have provided there is no use of image so please provide code – Mrugesh Tank Mar 26 '15 at 07:48
  • 2
    Hi @MrugeshTank I've already included all the code above... The error code is quite confusing since "hello" is not an image, it's just a string. Commenting out the "lblPassword.setText("hello")" will remove the warning... but that's not what i want to achieve. – user1872384 Mar 30 '15 at 01:44
  • none of the answers here are relevant. Just like you, even I don't have any images and whenever I set a text to a label, it logs that it's unable to find any image name with that text. Definitely a bug. – sudoExclaimationExclaimation Dec 11 '18 at 07:21

8 Answers8

5

Cleaning the project doesn't seem to fix the issue for me. But if you click on the image file, you'll see "Target Membership" options on the right pane. Select all of them, Clean the build and try again.

EdwardSanchez
  • 95
  • 1
  • 8
4

I got the same error although I am pretty sure these image files exist.

I just terminated Xcode, relaunched it, cleaned the project (command + K) and built it. It started to work again.

I do this routine whenever I face a new problem. It solves most of the problems as you might know. Sorry if you have done it already.

Yuichi Kato
  • 863
  • 7
  • 16
  • Thanks Yuichi Kato, I've reopened XCode, but the issue still persist. I ended up reverting my project file to the previous version and it works. Not sure what went wrong in the previous version. – user1872384 Mar 30 '15 at 01:06
  • good to hear that you are no longer stuck. I suspect this is a bug in xcode. – Yuichi Kato Mar 30 '15 at 01:10
1

I supposed that you adding image to asset catalog in WatchKit Extension. This is wrong.You should add that image to asset catalog in WatchKit App. Sorry i can't add image here.

Onvil
  • 21
  • 2
0

Try as I might, my images were not loaded up to the watch until I did it directly by 'caching' as follows in my InterfaceController in the WatchKit Extension:

[[WKInterfaceDevice currentDevice] addCachedImage:[UIImage imageNamed:@"carrota.png"] name:@"carrot"];

[self.portfiolioImage setImageNamed:@"carrot"];
Peter B. Kramer
  • 16,385
  • 1
  • 16
  • 20
0

For me, it looks like you have added "hello" as an image name somewhere in the storyboard. Use XCode's Find dialog to look for "hello". It will show use as an image name, too.

0

Screen Shot 1

Ok So the keything to note here is that "you do not want to drag and drop the images into the AssetCatalog"......the only way this worked for me was to manually right click on the catalog (as shown in screen shot 1 and "Add Files"....look for the image you want to add on your local/external drive (Making Sure that only the "WatchKit App" Checkmark is selected in the Add to Targets Section" as shown in Screen Shot 2) and add the images!!

Screen Shot 2

0

i've had the exact same problem. solution: i've exedently connected the group parenting the WKInterfaceLabel. Try setting YOURSUPPOSEDLABLE.setTextColor(.brown), if the Background of it changes, you have connected the group.

Jonathan
  • 443
  • 3
  • 9
0

So in my case I had copied and pasted a prior row and assigned a diff class.

That duplicated row's group still had an IBOutlet connection to the prior class that I did not catch.

Once I removed that connection this stupid issue resolved itself and I was able to successfully call .setText()

David Villegas
  • 458
  • 3
  • 18