Flaviu's Blog - Read'n'Code

RestKit 0.20 : No Response Descriptors Match the Response Loaded

Well, as the error message in XCode and as Blake Water explains in this github issue the paths don’t match.

It’s especially subtle when you have a get parameter, like I did:

1
2
NSString *resourcePath = [NSString stringWithFormat:@"/counties_by_zip/?zipcode=%@", zipCode];
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:[MappingProvider zipMapping] pathPattern:resourcePath keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

It turns out that if you have a parameter like that, your path needs to NOT include it, like so:

1
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:[MappingProvider zipMapping] pathPattern:@"/counties_by_zip/" keyPath:nil statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

That’s it folks. 2 hours of my time. It’s yours.

Comments

Fork Flaviu on GitHub