Take the 2-minute tour ×

Very confusing times here adding various requests to a project in development. For two objects so far setObjectMapping:forResourcePathPattern: works fine. These have resource patterns like @"customer/login/" and @"customer/getDuckStatus/". A query that fails to create an object with correct mapping is @"customer/getPondsForDuck/"

// this define is used for object mapping and for creating the query, 
// it can't be a mismatch
#define kResourcePathDuckPond @"customer/getPondsForDuck/"

The only difference I can see in the queries is that the keypath in the returned JSON is nil for the first two queries that work. When the keypath is nil and forResourcePathPattern is used to set object mapping, objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects (RKObjectLoaderDelegate method) receives a valid object with correct mapping. When the keypath is non-nil, using forResourcePathPattern always sends didLoadObjects: a nil object.


[[RKObjectManager sharedManager].mappingProvider setObjectMapping:duckMapping

fails. Using

[[RKObjectManager sharedManager].mappingProvider setObjectMapping:duckMapping

(where "ponds" is the keypath given in the returned JSON) works fine.

Is that the rule, forResourcePathPattern will fail unless keypath is nil? I'd like to have all my objects recognized the same way. While I can get it working I don't like using key path for one query and resource path for others. I wanted to use forResourcePathPattern for everything since I don't have control of the API and some queries return a keypath while some don't.

share|improve this question
add comment


Your Answer



Browse other questions tagged or ask your own question.