0

我有两个对象,项目和类别。我有大多数查询的具体网址,所以映射很好。但是对于某些项目请求,我有更改 URLS 的动态映射,它看起来像这样:

[RKResponseDescriptor responseDescriptorWithMapping:goodMapping
                                        pathPattern:nil
                                            keyPath:nil
                                        statusCodes:statusCodes]

如果存在,我的类别将无法映射,尽管这是项目映射。如果我将此行注释掉,一切正常。我的问题是我无法设置 pathPattern,因为即使我将路径设置为实际路径它也无法检测到它,这是我得到的错误:

failed to match: response path 'catalog/item?category_id=2' did not match the path pattern 'catalog/item?category_id=2'

我尝试用 ":id" 替换 "2" 无济于事。我也无法设置 keyPath,因为我正在从服务器获取未命名的数组。

如何更改我的映射以便映射我的对象并检测到它们?

4

1 回答 1

0

I managed to make it work by exactly matching pathPattern to request url, ignoring all get parameters, so it was "catalog/item" in request and "catalog/item" in mapping and everything worked, even if the resulting url is catalog/item?category_id=2.

于 2013-07-04T04:12:56.757 回答