如何在RestKit中映射没有KVC的Json数组

时间:2016-08-24 08:22:27

标签: ios restkit

我的json响应如下:

[
  {
    "DateOfBirth": "1951-08-02T00:00:00",
    "Age": "65",
    "Gender": "Female",
    "FirstName": "abc",
    "LastName": "xyz"
  }
]

顶层没有任何密钥。

RKObjectMapping *entityMapping = [RKObjectMapping mappingForClass:[MyEntityModel class]];
[entityMapping addAttributeMappingsFromDictionary:@{ @"DateOfBirth": @"dateOfBirth",
            @"Age": @"age",
            @"Gender": @"gender",
            @"FirstName": @"firstName",
            @"LastName": @"lastName"
    }];

RKResponseDescriptor *descriptor = [RKResponseDescriptor responseDescriptorWithMapping:patientMatchingMapping method:RKRequestMethodGET pathPattern:nil keyPath:nil statusCodes:code];

这不会映射对象,并且在实体类中具有空映射。如何映射此类响应?

0 个答案:

没有答案