所以我对这两个功能的区别有多么困惑,或者至少是如何将它们合并在一起.我有这种情况,我有这个描述符:
RKResponseDescriptor *responsePlant = [RKResponseDescriptor responseDescriptorWithMapping:plantMapping pathPattern:@"/api/rest/plants/:plant_id" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
现在,我想做这样的事情
RKResponseDescriptor *responsePlantAll = [RKResponseDescriptor responseDescriptorWithMapping:plantMapping pathPattern:@"/api/rest/plants/" keyPath:@"objects" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
请注意,keyPath在一个地方是零,而在另一个地方则不是.
这有效…但它是很多副本粘贴.我可以使用RKRouter吗?
非常感谢!
解决方法
你调用两个不同的路径,所以使用两个不同的RKResponseDescriptor对我来说非常有意义!
I also would like to know if you can or should use RKRouter with
RKResponseDescriptor?
我真的建议使用Routes.有了它们,我的所有路径都集中在我的RKObjectManager子类中,所以如果我必须改变路径,我不必到处寻找!