I have some problems displaying a JSON array for RestKit. This is what the JSON file looks like:
{"issuelist":[
{
"issue":[
{
"id":1,
"beschreibung":"",
"name":"Test1"
},
{
"id":2,
"beschreibung":"",
"name":"Test2"
}
]
}
]}
I am interested in the array "issue". This is my mapping for one problem:
RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[self class] usingBlock:^(RKObjectMapping *mapping) {
[mapping mapAttributes:@"name", @"beschreibung", nil];
[mapping mapKeyPathsToAttributes:
@"id", @"identifier",
nil];
}];
And this is how I configure ObjectMapping
RKObjectMappingProvider *omp = [RKObjectManager sharedManager].mappingProvider;
RKObjectMapping *issueMapping = [Issue mapping];
[omp addObjectMapping:issueMapping];
[omp setObjectMapping:issueMapping forKeyPath:@"issuelist.issue"];
Unfortunately this will not work. I get the log output as follows:
T restkit.object_mapping: RKObjectMappingOperation.m: 152 Found transformable value at keyPath 'name'. Transforming from type '__NSArrayI' to 'NSString'
W restkit.object_mapping: RKObjectMappingOperation.m: 232 Failed transformation of value at keyPath 'name'. No strategy for transforming from '__NSArrayI' to 'NSString'
T restkit.object_mapping:RKObjectMappingOperation.m:339 Skipped mapping of attribute value from keyPath 'name to keyPath 'name' -- value is unchanged ((null))
T restkit.object_mapping:RKObjectMappingOperation.m:322 Mapping attribute value keyPath 'beschreibung' to 'beschreibung'
T restkit.object_mapping:RKObjectMappingOperation.m:152 Found transformable value at keyPath 'beschreibung'. Transforming from type '__NSArrayI' to 'NSString'
W restkit.object_mapping:RKObjectMappingOperation.m:232 Failed transformation of value at keyPath 'beschreibung'. No strategy for transforming from '__NSArrayI' to 'NSString'
T restkit.object_mapping:RKObjectMappingOperation.m:339 Skipped mapping of attribute value from keyPath 'beschreibung to keyPath 'beschreibung' -- value is unchanged ((null))
T restkit.object_mapping:RKObjectMappingOperation.m:322 Mapping attribute value keyPath 'id' to 'identifier'
T restkit.object_mapping:RKObjectMappingOperation.m:152 Found transformable value at keyPath 'id'. Transforming from type '__NSArrayI' to 'NSString'
W restkit.object_mapping:RKObjectMappingOperation.m:232 Failed transformation of value at keyPath 'id'. No strategy for transforming from '__NSArrayI' to 'NSString'
T restkit.object_mapping:RKObjectMappingOperation.m:339 Skipped mapping of attribute value from keyPath 'id to keyPath 'identifier' -- value is unchanged ((null))
D restkit.object_mapping:RKObjectMappingOperation.m:624 Finished mapping operation successfully...
, RestKit , .
, ?
!