在Restkit中没有路径的JSON映射对象

时间:2012-10-11 13:29:08

标签: iphone objective-c ios restkit

我不知道更好的头衔.. 我想映射一个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: ""

谢谢

0 个答案:

没有答案