Instead of a clustered:
- (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects
{
if (objectLoader.method == RKRequestMethodGET) {
if ([objectLoader.resourcePath isEqualToString:@"/blah"]) {
// ...
}
} else if (objectLoader.method == RKRequestMethodPUT) {
if ([objectLoader.resourcePath hasSuffix:@"/blahblah"]) {
// ...
}
} else if (objectLoader.method == RKRequestMethodPOST) {
if ([objectLoader.resourcePath isEqualToString:@"/blahblahblah"]) {
// ...
}
}
}
I’d prefer a block approach, especially for simpler requests without any object mapping. Is there any documentation or example of how to use block response?
I don’t think there is support for this configuration in the latest (0.10.1) version of RestKit.
There is
- (void)loadObjectsAtResourcePath:(NSString *)resourcePath usingBlock:(RKObjectLoaderBlock)blockselector, however the block is invoked to allow you to configure theObjectLoader.You may also use
userDataproperty to distinguish multiple requests, i provided more details in this answer.