Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/106.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何根据RestKit中的关键路径分离相似的实体映射?_Ios_Objective C_Restkit - Fatal编程技术网

Ios 如何根据RestKit中的关键路径分离相似的实体映射?

Ios 如何根据RestKit中的关键路径分离相似的实体映射?,ios,objective-c,restkit,Ios,Objective C,Restkit,我有一个叫做过滤器的对象。 它有两个字段-id(字符串)和title(字符串)。过滤器代表衣服的过滤,有三种类型的过滤器——颜色、尺寸和品牌。我想让他们分开,从现在起,他们到达相同的阵列 这是我的密码: [filtersMapping addAttributeMappingsFromDictionary:@{@"id": @"id_", @"title" : @"title"}]; filtersMapping.identificationAttributes = @[@"id_"]; [obj

我有一个叫做过滤器的对象。 它有两个字段-id(字符串)和title(字符串)。过滤器代表衣服的过滤,有三种类型的过滤器——颜色、尺寸和品牌。我想让他们分开,从现在起,他们到达相同的阵列

这是我的密码:

[filtersMapping addAttributeMappingsFromDictionary:@{@"id": @"id_", @"title" : @"title"}];
filtersMapping.identificationAttributes = @[@"id_"];
[objectManager addResponseDescriptor:[RKResponseDescriptor responseDescriptorWithMapping:filtersMapping
                                                                             pathPattern:@"catalog/filter"
                                                                                 keyPath:@"size_values"
                                                                             statusCodes:statusCodes]];

[objectManager addResponseDescriptor:[RKResponseDescriptor responseDescriptorWithMapping:filtersMapping
                                                                             pathPattern:@"catalog/filter"
                                                                                 keyPath:@"brand_values"
                                                                             statusCodes:statusCodes]];

[objectManager addResponseDescriptor:[RKResponseDescriptor responseDescriptorWithMapping:filtersMapping
                                                                             pathPattern:@"catalog/filter"
                                                                                 keyPath:@"color_values"
                                                                             statusCodes:statusCodes]];
从映射中可以看到,我从服务器上得到了三个数组。它们是尺寸值、品牌值和颜色值。现在,当我得到映射结果时,我得到了一个巨大的过滤器值数组,所有这些过滤器都来自这里


我想向它们添加另一个属性,说明它们的来源,如颜色或品牌,但如何根据我从中收到的密钥路径分配此属性?

而不是从映射结果中获取
数组
,而是获取
字典
。其中包含响应描述符中的所有键路径作为键,映射对象数组作为值

您需要使用字典中的键来更新对象,因为我认为映射元数据中没有键路径(尽管这值得检查)