我不知道更好的头衔.. 我想映射一个JSON,但json有这个结构
{
"error_code": "1001",
"error_message": "There is another session"
}
例如,所以我有类错误,有2个属性,这是映射的代码:
RKObjectMapping *errorMapping = [RKObjectMapping mappingForClass:[Error class]];
[errorMapping mapKeyPathsToAttributes:@"error_code", @"error_code", @"error_message", @"error_message", nil];
[[objectManager mappingProvider] setMapping:errorMapping forKeyPath:@""];
我收到了这个错误:
Adding mapping error: Could not find an object mapping for keyPath: ""
谢谢