这是我的回复正文:
{
"bsqn": 5,
"results": [
{
"sqn": 1,
"res": "oldu!"
}
]
}
我想通过使用这个 keyPath:"bsqn.res" 来获得我真正需要的“res”属性
//TestResponse.h
@interface TestResponse : NSObject
@property (nonatomic, copy) NSString *res;
+ (RKObjectMapping *)objectMapping;
@end
// TestResponse.m
@implementation TestResponse
+ (RKObjectMapping *)objectMapping
{
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[self class]];
[mapping addAttributeMappingsFromDictionary:@{@"res": @"res"}];
return mapping;
}
@end
RKResponseDescriptor *newDesc = [RKResponseDescriptor responseDescriptorWithMapping:
[TestResponse objectMapping] method:RKRequestMethodPOST pathPattern:nil keyPath:@"bsqn.res"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
但它给出了这个错误:
this class is not key value coding-compliant for the key hashcode
有没有办法做我想做的事?谢谢..