RestKit RKObjectMapping问题

时间:2014-01-22 15:49:27

标签: ios objective-c

我的restkit调用返回了以下JSON:

{"test":{"123423":{"id":"123423","type":"mood","stress":null}}}

我正在使用以下映射

RKObjectMapping *testResponseMapping = [RKObjectMapping mappingForClass:[TestDataResponse class]];

[testResponseMapping addAttributeMappingToKeyOfRepresentationFromAttribute:@"itemNumber"];
[testResponseMapping addAttributeMappingsFromDictionary:@{
                                                             @"(itemNumber).id":@"id",
                                                             @"(itemNumber).type":@"type",
                                                             @"(itemNumber).stress":@"stress"
                                                             }];

RKResponseDescriptor *testResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:testResponseMapping method:RKRequestMethodAny pathPattern:nil keyPath:@"test" statusCodes:[NSIndexSet indexSetWithIndex:200]];

这不太正确,因为我不确定我是否正确处理第一个“123423”(这是一个更改的数字)。 如何更新我的代码以适应这种情况?谢谢!

0 个答案:

没有答案