handleWatchKitExtensionRequest
对您的行为有限制吗?我尝试从资源包中返回UIImage
但我收到nil
回复。
这有效:
-(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
reply(@{@"Returning the number 1":@(1)});
}
这失败了:
-(void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply
{
UIImage *image = [UIImage imageNamed:@"icon-152x152.png"];
reply(@{@"image":image});
}
答案 0 :(得分:3)
您传递的字典必须符合属性列表,这意味着您需要在发送之前将不是字符串,数字,字符串和数组的类转换为NSData。 How to convert UIImage to NSData.