I'm writing a client for a semi-REST web service (for now it only supports GET requests).
My problem is next. I have one base URL and two types of resources each one on the different resource path.
By this time I have two classes that represent that resources structures, I have two instances of RKObjectMapping
for mapping each resource type, and I have two instances of RKObjectManager
each one with different mapping. In app I load resources calling loadObjectsAtResourcePath:
on each instance of RKObjectManager
.
Can someone suggest how can I improve my code, because I feel that I should use only one instance of RKObjectManager
as I work with only one web service.
I will be very thankful for any advice, because I've searched a lot and haven't found any solution.
In order to use one RKObjectManager, I think you can do something like this:
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:somePath
usingBlock:^(RKObjectLoader* loader) {
// Set the mapping to use for this particular request
loader.objectMapping = specificObjectMappingRequired;
loader.delegate = ...
}];
See RKObjectManager reference for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With