I'm creating a iWatch app in which I need to display an array of images. I'm using WCSession
to transfer the images from the iPhone. Here is the code I tried:
InterfaceController.m
- (void)willActivate {
[super willActivate];
if ([WCSession isSupported]) {
WCSession *session = [WCSession defaultSession];
session.delegate = self;
[session activateSession];
NSLog(@"WCSession is supported");
}
- (void)session:(WCSession *)session didReceiveApplicationContext:(NSDictionary<NSString *,id> *)applicationContext {
NSLog(@"%@", applicationContext);
NSData *imageData = applicationContext[@"image"];
UIImage *contactImage = [UIImage imageWithData:imageData];
_graphImage = [contactImage valueForKey:@"image"];
}
In my iPhone app, I have an array which stores the images in bytes. After executing the iWatch app, I'm getting the NSData
value from my iPhone app. But the app terminates at UIImage *contactImage = [UIImage imageWithData:imageData];
with
[__NSCFArray length]: unrecognized selector sent to instance.
I googled this error but not able to find a solution in my case.
Any help will be greatly appreciated.