RestKit/RestKit — Issue #524: issues with RKDynamicObjectMapping
Author: ojosdegris
Created: 2012-01-23 16:59:28+00:00
State: open

i have the following code

RKObjectMapping* cutMapping = [RKObjectMapping mappingForClass:[Cut class]];
[cutMapping mapKeyPath:@"CutID" toAttribute:@"cutID"];
RKObjectMapping* journalMapping = [RKObjectMapping mappingForClass: [Journal class]];
[journalMapping mapKeyPath:@"journalID" toAttribute:@"journalID"];
RKDynamicObjectMapping * dynamicMapping = [RKDynamicObjectMapping dynamicMapping];
[dynamicMapping setObjectMapping:journalMapping whenValueOfKeyPath:@"__metadata.type" isEqualTo:@"JournalDetails"];
[dynamicMapping setObjectMapping:cutMapping whenValueOfKeyPath:@"__metadata.type" isEqualTo:@"Cut"];
[[[RKObjectManager sharedManager] mappingProvider] setMapping:dynamicMapping forKeyPath:@"d"];

in both cases i have an json return from serivce which has just one field 'd' which is array of either journal or cut objects
mapping for cuts works for journals not.