我的宁静 API:
GET http://example.com/articles
GET http://example.com/articles/:id
...
这是我的描述符设置:
RKResponseDescriptor *responseDescriptorArticleList = [RKResponseDescriptor
responseDescriptorWithMapping:articleMapping
method:RKRequestMethodGET
pathPattern:@"/articles"
keyPath:@nil
statusCodes:[NSIndexSet indexSetWithIndex:200]];
RKResponseDescriptor *responseDescriptorArticle = [RKResponseDescriptor
responseDescriptorWithMapping:articleMapping
method:RKRequestMethodGET
pathPattern:@"/articles/:id"
keyPath:nil
statusCodes:[NSIndexSet indexSetWithIndex:200]];
(GET) http://example.com/articles的功能有效
[objectManager getObjectsAtPath:@"/articles"
parameters:nil
success:^sucess{...} failure:^failue{...}];
(GET) http://example.com/articles/:id的功能不起作用
//Whatever Object is article object or article.id, it doesn't work
[objectManager getObject:Object path:@"/articles/:id"
parameters:nil
success:^sucess{...} failure:^failue{...}];
服务器控制台显示:
GET /articles/:id 404 117ms
显然它没有用 article.id 替换 /:id
我浏览了看起来没有针对 0.20.x 更新的 RestKit 文档和示例,但没有找到答案。我会感谢你的帮助。