1

そのためのより良いタイトルを知りませんでした.JSONをマップしたいのですが、jsonにはこのestructureがあります

{
   "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: ""

ありがとうございました

4

0 に答える 0