Note that there are some explanatory texts on larger screens.

plurals
  1. PORestkit mapping of array of heterogeneous arrays
    primarykey
    data
    text
    <p>I am totally stuck trying to map this JSON data:</p> <pre><code>{ "All_Data": [ { "TANTENNE": [ {"ID": 2068, "KIND": "PARABOLE"}, {"ID": 2069, "KIND": "ANTENNE TNT HERTZIENNE"}, {"ID": 2070, "KIND": "ANTENNE COLLECTIVE"}, {"ID": 2071, "KIND": "PARABOLE PLATE"} ], "totalCount": 4, "success": true }, { "success": true, "FANTENNE": [ {"ID": 1121, "CONNECT": "Autre"}, {"ID": 1122, "CONNECT": "Neovia"}, {"ID": 1124, "CONNECT": "non"}, {"ID": 1125, "CONNECT": "oui"}, {"ID": 1126, "CONNECT": "Patch"}, {"ID": 1127, "CONNECT": "SRTD"}, {"ID": 1128, "CONNECT": "Standard"} ], "totalCount": 7 }, { "MANTENNE": [ {"ID": 2065, "STATUS": "NON PRESENTE", "ACTION": 1}, {"ID": 2066, "STATUS": "DEFECTUEUSE", "ACTION": 2}, {"ID": 2067, "STATUS": "2EME ANTENNE POSEE", "ACTION": 3} ], "totalCount": 3, "success": true }, { "totalCount": 5, "LANTENNE": [ {"ID": 1139, "LOCATION": "AU SOL"}, {"ID": 1140, "LOCATION": "Balcon"}, {"ID": 1142, "LOCATION": "FACADE"}, {"ID": 1143, "LOCATION": "Toit"}, {"ID": 2064, "LOCATION": "JARDIN"} ], "success": true }, ], "success": true } </code></pre> <p>Given that I have Core Data entities (and associated classes for all individual leaf objects (<code>TANTENNE</code>, <code>FANTENNE</code>, <code>MANTENNE</code>, <code>LANTENNE</code>).</p> <p>When I receive the above JSON, I would like to insert 4 instances of <code>TANTENNE</code>, 7 instances of <code>FANTENNE</code>, 3 instances of <code>MANTENNE</code>, and 5 instances <code>LANTENNE</code>.</p> <p>I have individual mappings for those classes, e.g.:</p> <pre><code>RKManagedObjectMapping *mapping = [RKManagedObjectMapping mappingForEntityWithName:@"TANTENNE" inManagedObjectStore:self.objectStore]; mapping.primaryKeyAttribute = @"id"; [mapping mapKeyPathsToAttributes: @"ID", @"id", @"KIND", @"kind", nil]; [self setObjectMapping:mapping forKeyPath:@"TANTENNE"]; </code></pre> <p>This is called at initialization time of my mapping provider. But this is clearly not enough as I get console messages such as</p> <pre><code>[…] T restkit.object_mapping:RKObjectMapper.m:293 Examining keyPath 'TANTENNE' for mappable content... […] D restkit.object_mapping:RKObjectMapper.m:303 Found unmappable value at keyPath: TANTENNE </code></pre> <p>If I add the mapping using the "All_Combo.TANTENNE" key path, then RestKit crashes later trying to map a full array to one destination object.</p> <p>This is with RestKit 0.10 (I haven't moved to 0.20 because all the Magical Record stuff is gone, and I use it a lot).</p> <p>Thanks for any insight.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload