iOS - RESTKit 0.20 - send multiple query parameters with the same name

微笑、不失礼 提交于 2019-12-13 05:18:48

问题


I am trying to send a GET request using RESTKit that looks like this: getNames?names=bob&names=joe&names=joey When I try to set the parameters dictionary with the same key names, it don't work. Only the first key and value get sent. I know there's a question about this from a long time ago here. But there is still no answer, and I was wondering if there's any development on this.


回答1:


I figured out a solution. This is the code I use:

[[RKObjectManager sharedManager] getObjectsAtPath:queryPath
                                           parameters:nil
                                              success:nil failure:nil];

and the queryPath looks like this: getNames?names=bob&names=joe&names=joey and it actually works. make sure to use stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding so that the & and ? will go through properly .



来源:https://stackoverflow.com/questions/25094284/ios-restkit-0-20-send-multiple-query-parameters-with-the-same-name

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