0

Are there restrictions on what you can do in handleWatchKitExtensionRequest? I tried returning a UIImage from the resource bundle but I get a nil reply.

This works:

-(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
    reply(@{@"Returning the number 1":@(1)});
}

This fails:

-(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
    UIImage *image = [UIImage imageNamed:@"icon-152x152.png"];
    reply(@{@"image":image});
}
Dennis
  • 2,119
  • 20
  • 29
Brainware
  • 531
  • 6
  • 15

1 Answers1

3

The dictionary you pass around must be property list compliant, meaning that you need to convert classes that aren't strings, numbers, dicts, and arrays, into NSData before you send it. How to convert UIImage to NSData.

Community
  • 1
  • 1
Schemetrical
  • 5,506
  • 2
  • 26
  • 43