Closed abduranjum closed 8 years ago
I need more information. If the array is nested to another object and the property name doesn't match the class name you need to write mapping. There are samples covering all cases here:
https://github.com/aryaxt/OCMapper/blob/master/OCMapperTests/ObjectMapperTests.m#L184
It maps ICATreatment if is a simple property, but fails if it is in an array.
if the property is named icaTreatment it would map it automatically, otherwise you need to write mapping. this is only needed for arrays since the runtime API can't tell the types of objects in an array.
[inCodeMappingProvider mapFromDictionaryKey:@"treatments" toPropertyKey:@"treatments" withObjectType:[ICATreatment class] forClass:[PARENT_CLASS class]];
There is example of this on readme
I could not find this example in the readme file. But it is working now after using the mapping you gave. I did that mapping before, but was wondering why it was needed, as the mapper could map the simple property, so I thought it would map the array also.
I have an array of treatments. The class name is ICATreatment. The mapper maps the array to dictionary correctly, but fails to map from dictionary to array.