我试图访问 JSON 中的对象,但 RestKit 一直告诉我路径不匹配,但实际上它们匹配!这让我发疯了。我尝试将路径模式更改为,catalog/item?category_id=:id
但没有帮助。
<RKResponseDescriptor: 0x7c6aba0 baseURL=http://pornhub.com/freeapi/public/bit/ pathPattern=catalog/item?category_id=1 statusCodes=200-299> failed to match: response path 'catalog/item?category_id=1' did not match the path pattern 'catalog/item?category_id=1'.
这是代码:
[objectManager addResponseDescriptorsFromArray:@[
[RKResponseDescriptor responseDescriptorWithMapping:goodMapping
pathPattern:@"catalog/item?category_id=1"
keyPath:nil
statusCodes:statusCodes]]];
唯一的细微差别是我在数组中获取项目,而不是在其他映射中获取原始项目本身。也许这起到了一些作用,但我不确定。
如何修复此错误?