I'm using RestKit 0.20 and detected a curious mapping behavior when using a canonical notation with dots (.). I would be glad, if you can explain a simple way of handling an object mapping from a flattened object which I implemented as an NSManagedObject on IOS to an object relation on server side.
The mapping is almost correct but the mapping of geopoint.lat and geopoint.lon as extra fields is wrong, from my perspective and raises an exception on the server (unrecognized property exception).
The RKObjectMapping:
[mapping addAttributeMappingsFromDictionary:@{
@"geopoint.lat": @"latitude",
@"geopoint.lon": @"longitude",
@"countrycode": @"countryId",
@"county": @"county",
@"postcode": @"postalcode",
@"city": @"city",
@"street": @"street",
@"housenumber": @"housenumber"
}];
The effective Result (shown as log output)
2013-01-29 09:29:38.856 CPlusApp[4285:907] T restkit.object_mapping:RKMappingOperation.m:514 Mapped relationship object from keyPath 'startAddress' to 'startAddress'. Value: {
city = aCity;
geopoint = {
lat = "48.8901234";
lon = "8.818448999999998976";
};
"geopoint.lat" = "48.8901234";
"geopoint.lon" = "8.818448999999998976";
postcode = 91000;
street = Rennbrunnen;
}
2013-01-29 09:29:38.861 CPlusApp[4285:907] D restkit.object_mapping:RKMappingOperation.m:818 Finished mapping operation successfully...