iOS - RESTKit 0.20 - send multiple query parameter

2019-09-05 08:44发布

问题:

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 .



标签: ios restkit