Objective c RestKit映射XML元素体

Objective c RestKit映射XML元素体,objective-c,ios,restkit,Objective C,Ios,Restkit,如何为XML元素体到对象属性创建RestKit对象映射 XML: 因此,如果您想要Response.body中的字符串“ok”(谁是Response对象的属性): 如果您的响应对象中有一个属性“response”,它会起作用,如下:[responseMapping mapKeyPath:@“response”到attribute:@“response”];你能详细描述一下回应对象吗?太好了,谢谢。问题是我正在将对象映射到它自己的元素keypath。response元素实际上包装在一个result

如何为XML元素体到对象属性创建RestKit对象映射

XML:


因此,如果您想要Response.body中的字符串“ok”(谁是Response对象的属性):


如果您的响应对象中有一个属性“response”,它会起作用,如下:[responseMapping mapKeyPath:@“response”到attribute:@“response”];你能详细描述一下回应对象吗?太好了,谢谢。问题是我正在将对象映射到它自己的元素keypath。
response
元素实际上包装在一个
result
元素中:
fail
,因此我更改了我的原始映射:
[[RKObjectManager sharedManager].mappingProvider setMapping:ResponseMappingForkeyPath:@“result.response”]收件人:
[[RKObjectManager sharedManager].mappingProvider setMapping:responseMapping forKeyPath:@“结果”]
<response>ok</response>
RKObjectMapping *responseMapping = [RKObjectMapping mappingForClass:[Response class]];
[responseMapping mapKeyPath:@"???" toAttribute:@"body"];
[responseMapping mapKeyPath:@"response" toAttribute:@"body"];