多RKRequestDescriptors我有两个途径:具有相同RKRequestMethod
POST/food.json
请求正文:{"food": {"name":"Banana", color:"yellow"}}
请求描述:
RKRequestDescriptor *createRequestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:createMapping
objectClass:[Food class]
rootKeyPath:@"food"
method:RKRequestMethodPOST];
-
POST/food/batch.json
请求正文:{"foods": [{"name":"Banana", color:"yellow"}, {"name":"Apple", "color":"red" }]}
请求描述:
RKRequestDescriptor *batchRequestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:createMapping
objectClass:[Food class]
rootKeyPath:@"foods"
method:RKRequestMethodPOST];
-
我遇到的问题是,该创建和批量要求都使用POST请求方法,所以如果我尝试将它们都添加为请求描述符,我会得到: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot add request descriptor: An existing descriptor is already registered for the class 'Food' and HTTP method'(POST)'.'
是否有一个有条件的请求描述符,我可以说:
使用batchRequestDescriptor
的路径/food/batch
和使用createRequestDescriptor为/food
路径?
啊,我希望有一个RKRequestDescriptor特定路径:( – 2014-09-25 01:30:02