I am sending a json blob wrapped in a iron mq message.
It comes to Restkit as a:
{
id:"2837409187409328",
delay:60,
body:"{ myJson:{ "hey":true}}"
}
Im using a rkrelationship to map a child object with the body: as type CustomObject.
However when Restkit tries to map to that custom object it blows up because it views that 'body' as a NSString instead of NSDictionary and tries to get the value out of the resulting sourceObject by using the sourceKeyPath... but since its a NSString it blows up. With:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFString 0x7fcf91165060> valueForUndefinedKey:]: this class is not key value coding-compliant for the key alreadyLiked.'
I have tried to use dynamic mapping and replace the representation with an NSDictionary.
I have tried doing validate on the accessors as is suggested in the docs, but that code is never called. Any ideas?
Solved with post processing. I ended up taking the string that was passed into the body, overriding the setter for that body property, and in that setter running a mapping operation to take the string of json, and map it to my custom object (after converting to a dictionary) then setting that on my parent object.
Hope this helps you!