Hello all,
I've got some JSON coming back from a service which at some times will have null instead of true/false for an attribute which is a boolean; Like this:
My object to receive this value has a property:
@property (nonatomic, assign) BOOL hideLocations;
My mapping is configured like this:
RKObjectMapping *retVal = [RKObjectMapping mappingForClass:[self class]];
[retVal mapKeyPath:@"hide_locations" toAttribute:@"hideLocations"];
But when I perform the mapping, RestKit 0.10.3 is crashing on this line:
[self.destinationObject setValue:value forKeyPath:attributeMapping.destinationKeyPath];
in
- (void)applyAttributeMapping:(RKObjectAttributeMapping *)attributeMapping withValue:(id)value
in RKObjectMappingOperation.m with the following error:
2012-11-13 09:33:04.352 Tests[73816:5f03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[<MyClass 0x13ba9a10> setNilValueForKey]: could not set nil as the value for the key hideLocations.'
It seems quite odd to me that a mature framework like this doesn't handle this situation more gracefully, so I can't help but think I've configured something incorrectly. I would appreciate any insights you might have.
Thanks,
Levi