0

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?

ohho
  • 50,879
  • 75
  • 256
  • 383

2 Answers2

0

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)block selector, however the block is invoked to allow you to configure the ObjectLoader.

You may also use userData property to distinguish multiple requests, i provided more details in this answer.

Community
  • 1
  • 1
mja
  • 5,056
  • 1
  • 29
  • 40
0

With 0.10.1, you can use blocks for POST, GET etc calls, check out this SO answer

Community
  • 1
  • 1
AngeloS
  • 5,536
  • 7
  • 40
  • 58