目前NSNumber被映射到字符串,例如:
@interface Blah:NSObject
@property NSNumber * num;
@end
将被映射到 { num:“5” }
而不是 { 数量:5 }有谁知道如何正确地将NSNumber映射到int,而不是字符串?
更新
RKObjectMapping *requestMapping = [RKObjectMapping requestMapping];
[requestMapping addAttributeMappingsFromArray:@[@"num"]];
RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:requestMapping objectClass:[MyClass class] rootKeyPath:nil method:RKRequestMethodPOST];
[_manager addRequestDescriptor:requestDescriptor];