我正在发送一个包裹在铁 mq 消息中的 json blob。
对于 Restkit,它是:
{
id:"2837409187409328",
delay:60,
body:"{ myJson:{ "hey":true}}"
}
我使用 rkrelationship 将子对象与主体映射:作为 CustomObject 类型。
但是,当 Restkit 尝试映射到该自定义对象时,它会爆炸,因为它将“body”视为 NSString 而不是 NSDictionary,并尝试使用 sourceKeyPath 从结果 sourceObject 中获取值......但由于它是 NSString 它炸毁。和:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFString 0x7fcf91165060> valueForUndefinedKey:]: this class is not key value coding-compliant for the key alreadyLiked.'
我尝试使用动态映射并用 NSDictionary 替换表示。
我已尝试按照文档中的建议对访问器进行验证,但从未调用过该代码。有任何想法吗?