Question

À quoi devrait ressembler le mappage si j'ai une réponse JSON comme ceci:

{
"persons":{
  "@size":"4",
  "person":[
     {
        "name":"John",
        "type":"Doe 1",
        "options":"some options"
     },
     {
        "name":"John",
        "type":"Doe 2",
        "options":"some other options"
     },
     {
        "name":"John",
        "type":"Doe 3",
     },
     {
        "name":"John",
        "type":"Doe 4",
     }
  ]
 }
 }

J'ai déjà essayé le mappage suivant, mais cela ne fonctionne pas:

RKManagedObjectMapping* personMapping = [RKManagedObjectMapping mappingForClass:[CDCustomFieldDefinition class]];
[personMapping mapKeyPath:@"label" toAttribute:@"label"];
[personMapping mapKeyPath:@"type" toAttribute:@"type"];
[personMapping mapKeyPath:@"options" toAttribute:@"options"];
personMapping.primaryKeyAttribute = @"label";

[[RKObjectManager sharedManager].mappingProvider setMapping:personMapping forKeyPath:@"persons"];

Mon objet tableau dans didLoadObjects: est toujours vide ... des idées? Merci beaucoup!

Était-ce utile?

La solution

Si la trajectoire devrait être

@"persons.person"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top