我不知道有更好的标题。我想映射一个 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: ""
谢谢