RestKit:映射nsnumber

时间:2014-08-12 07:53:19

标签: objective-c restkit

目前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];

0 个答案:

没有答案