[__NSCFArray 长度]:发送到实例的无法识别的选择器

[__NSCFArray length]: unrecognized selector sent to instance

我正在创建一个 iWatch 应用程序,我需要在其中显示一组图像。我正在使用 WCSession 从 iPhone 传输图像。这是我试过的代码:

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"];
}

在我的 iPhone 应用程序中,我有一个以字节为单位存储图像的数组。执行 iWatch 应用程序后,我从我的 iPhone 应用程序中获取了 NSData 值。但是应用程序终止于 UIImage *contactImage = [UIImage imageWithData:imageData];

[__NSCFArray length]: unrecognized selector sent to instance.

我用谷歌搜索了这个错误,但找不到适合我的解决方案。

任何帮助将不胜感激。

您收到此错误是因为错误放置了类型 -_graphImage = [contactImage valueForKey:@"image"]; - 此处您正在为图像实例发送 valueForKey