4

I ran into a problem yesterday when my application was rejected. Apparently the images are not being displayed on the actual Apple Watch, however they are being displayed in the simulator. I even tried resetting the simulator and can't replicate the problem that occurred for the apple employee. So I am just wondering what the correct way to add/display images on the apple watch is, such so that they will be displayed properly on the actual hard device?

Code:

.h

@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageHeliLeft;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageHeliRight;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageHeliCenter;

@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsTL;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsTM;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsTR;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsML;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsMM;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsMR;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsBL;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsBM;
@property (strong, nonatomic) IBOutlet WKInterfaceImage *imageObsBR;

.m When I actually set an image programmatically

[self.imageHeliLeft setImageNamed:@"helicopter_1"];

Other wise I used the interface builder to set the image

bolencki13
  • 89
  • 1
  • 8
  • I'm not able to answer your question but I think you should already show how YOU did it so someone can point out if they did it differently. And at least you'll be able to try. About the _correct_ way I suggest you re-read what you saw in the apple docs the first time and make sure you're following their guidelines. – Gil Sand Apr 14 '15 at 15:37
  • have you got any mixed-case names. The hardware will most likely have a case-sensitive file system while the Sim is case-insensitive. i.e on hardware `bunny.png != Bunny.png` – Warren Burton Apr 14 '15 at 15:40

4 Answers4

2

Here is the answer. I cannot disclose why I know this, but this is what you need to do.

  1. Remove all images from your Watch App target.
  2. Added images to an image asset file that is in your Watch App target.
  3. Reference the images by the name in the asset file.

If you can see the images in the simulator and they are not in your Watch App target and they are in an asset file then they will work for the reviewer.

Stephen Johnson
  • 5,293
  • 1
  • 23
  • 37
  • I implemented this and so far everything is showing in the simulator. Hopefully the images continue to show on the hardware. – bolencki13 Apr 14 '15 at 16:04
  • I found that when I removed my images (.png, and .jpg) files from my Watch App target and the images still showed up in the simulator because they were in an image asset file the images worked on a real device. – Stephen Johnson Apr 14 '15 at 16:06
  • 1
    You should always avoid using image extensions when using imageNamed so the proper asset is chosen as well (@2x, @3x etc.). Although he did this in his example. If Apple would send me my damn watch I could test this for you. ;-) – Mark McCorkle Apr 14 '15 at 16:13
  • Any chance you can disclose why you know this yet? – Edwin Finch Dec 05 '17 at 04:52
2

As of Xcode 6.3, iOS 8.3:

Leave off the ".png" part of the image name. It will look strange in the storyboard, showing a blue "?", instead of the image thumbnail, but will work on both the simulator and watch. Same goes for specifying PNGs for Context Menus and programmatically specifying animation.

Warren Stringer
  • 1,692
  • 1
  • 17
  • 14
  • I have verified this workaround for Interface Controllers in Xcode 6.3.1. (Glance controllers seem fine with the extension specified.) – AlexD May 13 '15 at 22:37
2

If you're setting the images in your extension code, you should add all the images to the extension target too.

rordulu
  • 412
  • 4
  • 12
0

Verify the filenames are correct and the images are placed in the correct target's asset library.

WatchKit Images

It is recommended that you place image resource files in the bundle of your WatchKit app (not in your WatchKit extension’s bundle). Placing them in the WatchKit app bundle lets you use the setImageNamed: method of this class to specify the animated image. Setting them using that method offers better performance by eliminating the need to transfer the images from the user’s iPhone to the Apple Watch. The other methods for setting an image must wirelessly send the UIImage object or image data that you provide to Apple Watch.

Mark McCorkle
  • 9,349
  • 2
  • 32
  • 42