Restkit post操作成功并返回预期的JSON数据,但mappingResult数组为空

时间:2014-04-21 21:35:13

标签: arrays json response restkit-0.20

我怀疑我的回答描述符需要工作。我一直在审查RestKit Wiki上的ObjectMapping文档。我已经为myitem定义了类数组对象的详细信息,并为数组中的所有对象

Restkit成功发布但返回空数组作为mappingResult数组...如何获取返回的JSON数据?我从早期版本的Restkit中找到了一些代码,但它现在可能无法正常工作。我如何获得返回的JSON响应对象,以便我自己解析它?

RKResponseDescriptor *itemsDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:myItemsMapping method:RKRequestMethodAny pathPattern:nil keyPath:@"myItems" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
    RKResponseDescriptor *itemDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:itemMapping method:RKRequestMethodAny pathPattern:@"/item" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

    [[RKObjectManager sharedManager] addResponseDescriptor:itemsDescriptor];
    [[RKObjectManager sharedManager] addResponseDescriptor:itemDescriptor];

0 个答案:

没有答案