Question

Because I have the Core Data objects same as the domain objects coming from the server I am using the following code to automatically setup the mapping:

RKObjectMapping *mapping = [RKEntityMapping mappingForEntityForName:entityClassName inManagedObjectStore:managedObjectStore];

// Get the list of attributes
NSEntityDescription* entityInfo = [NSEntityDescription entityForName:entityClassName inManagedObjectContext:managedObjectContext];

[mapping addAttributeMappingsFromArray:[[entityInfo attributesByName] allKeys]];

Later, because there is one attribute which is specific I need to update the mapping.attributeMappings array. But I can not remove/clear the old array as it is read only. Is there any official way how to update the array?

Was it helpful?

Solution

No, you would usually create a new mapping (and usually a different response descriptor such that you could switch between them without changing the configuration of the object manager).

Technically, you could subclass RKObjectMapping, or add a category to it, and modify mutablePropertyMappings to achieve your goal.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top