问题
How do I create a RestKit object mapping for an XML element body to an object attribute?
XML:
<response>ok</response>
Mapping:
RKObjectMapping *responseMapping = [RKObjectMapping mappingForClass:[Response class]];
[responseMapping mapKeyPath:@"???" toAttribute:@"body"];
回答1:
So if you want the string 'ok' in Response.body (who is an attribute of Response object) :
[responseMapping mapKeyPath:@"response" toAttribute:@"body"];
It works ?
来源:https://stackoverflow.com/questions/9196947/restkit-map-xml-element-body