animatedImageNamed and WatchKit App assets

I have the following code in my WatchKit Extension


    UIImage *loadingCogs = [UIImage animatedImageNamed:@"LoadingClock" duration:3.0];
    [self.rowIcon setTintColor:[UIColor greenColor]];
    [self.rowIcon setImage:loadingCogs];
    [self.rowIcon startAnimating];


The "LoadingClock" image sequence is stored in the Assets.xcassets repository of the WatchKit App.

The images are all @2x and I have ticked watchOS for the device.


With a clean build the images do not display on the watch (or in the simulator).


if I put the images in the Assets.xcassets file of the Watchkit Extension the animated image sequence is shown on the watch and in the simulator.



I thought that with the images stored in the WatchKit App that this avoids any transfer from the iPhone to the Watch and for application performance that's exactly what I want. The purpose is defeated if I can't get the imagesequcne to load.


Does this forum group have any recommendations of what I could do to diagnose/resolve this?


- David

Replies

I have performed a further test.


I loaded two different images with the same name into each of the Assets.xcassets files in the WatchKit App and WatchKit Extension. I re-ran the application in the simulator. The image from Assets.xcassets via WatchKit Extension was loaded.


Can I load the one from the WatchKit App? What do I need to do to achieve that?


- David

From watchOS 2 Transition Guide:

A Watch app for watchOS 2 consists of two separate bundles that work together to deliver your content to the user. The Watch app itself contains the storyboards and resource files needed to display your interface, and the WatchKit extension contains the code and resources needed to update that interface.

In watchOS 2, the extension runs on the user’s Apple Watch instead of on the user’s iPhone, as was the case in watchOS 1.


So there isn't any transfer from the iPhone to the Watch.

I haven't tried to load an image sequence from App bundle but I think you can just leave your images in Extension bundle.

Thank you for finding that reference. Now things make sense.