0

I had used restkit in my project and i am trying to map the json data.

Response data format is from json GET webservice is :

    [
      {
         "Id":"XXXX",
         "detailId":"XXXX",
         "OriginalTitle":"XXXX"
      },
      {
         "Id":"XXXX,
         "detailId":"XXXX",
         "OriginalTitle":"XXXX"
       }
    ]

How can i map the data with any key.

Generally i use below to map

     RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[self class]];
     [objectMapping addAttributeMappingsFromDictionary:@{@"status":@"strStatus",
@"message":@"strMessage"}]; 

     [objectMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"***MyKeyfromAPI***" toKeyPath:@"MyArrayVariableInProject" withMapping:[***SomeModelClass*** mapping]]];

Error are something like :

[request=1.0424s mapping=0.0000s total=1.2667s]: Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No response descriptors match the response loaded." 
{Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No mappable object representations were found at the key paths searched." UserInfo={NSLocalizedDescription=No mappable object representations were found at the key paths searched., NSLocalizedFailureReason=The mapping operation was unable to find any nested object representations at the key paths searched: 
This likely indicates that you have misconfigured the key paths for your mappings., keyPath=null, DetailedErrors=(
)}}, keyPath=null, NSLocalizedDescription=No response descriptors match the response loaded.}

but in the response i have any key for array. How can i map this. Please help.

Jitendra Modi
  • 2,344
  • 12
  • 34
ios developer
  • 3,363
  • 3
  • 51
  • 111

0 Answers0