RestKit map XML element body

左心房为你撑大大i 提交于 2019-12-13 16:18:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!