RestKit 0.20 -- 多个具有相同名称的查询参数? [英] RestKit 0.20 -- Multiple query parameters with same name?

查看:38
本文介绍了RestKit 0.20 -- 多个具有相同名称的查询参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 iOS 应用程序,它使用 RestKit 0.20-rc1 来提供 RESTful 服务.我正在尝试执行 GET,借此我提供多个具有相同名称的查询参数来检索一组相同类型的对象.例如,我的网址如下所示:

I have an iOS application making use of RestKit 0.20-rc1 for RESTful services. I'm trying to perform a GET whereby I am providing multiple query parameters with the same name to retrieve a set of objects of the same type. For example, my URL would look like:

http://mysite.com/rest/myobjects?objID=123&objID=234&objID=345

我的网络服务能够接受这样的查询并返回适当的对象.我在客户端上的 RestKit 代码如下所示:

My web service is able to accept a query like this and return the appropriate objects. My RestKit code on the client looks something like this:

NSDictionary *params = ...
RKObjectManager *objMgr = [RKObjectManager sharedManager];
[objMgr getObjectsAtPath:@"/rest/myobjects" parameters:params success:nil failure:nil];

我的问题是,必须将参数指定为 NSDictionary,并且我有多个同名的参数.我尝试将 NSDictionary 中的值设置为包含所有参数值的 NSArray,但这不起作用.

My problem, is that the parameters must be specified as an NSDictionary, and I have multiple parameters with the same name. I tried setting the value in the NSDictionary to an NSArray containing all of the parameter values, but that did not work.

如何使用这种方法在 RestKit 中指定多个具有相同名称的查询参数?这只是 RestKit 不支持吗?

How do I specify multiple query parameters with the same name in RestKit using this methodology? Is this just not supported in RestKit?

推荐答案

听起来您拥有的 RestKit 代码无法实现.您可以:

Sounds like it is not going to be possible with the RestKit code you have. You may either:

  1. 更改代码以允许使用 NSArray.RestKit 在 https://github.com/RestKit
  2. 上是开源的
  3. 在 RestKit 谷歌小组中询问其他人是如何解决这个问题的.https://groups.google.com/forum/?fromgroups#!forum/restkit
  4. 向 RestKit 提交补丁并等待支持您所要求的版本的版本.

这篇关于RestKit 0.20 -- 多个具有相同名称的查询参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆