не бери в голову вот как я это сделал
@interface RestKitUtil : NSObject <RKObjectLoaderDelegate,RKRequestDelegate>
-(void)postobj;
@end
@implementation RestKitUtil
-(void)postobj{
RKLogConfigureByName("RestKit/Network", RKLogLevelTrace);
[RKObjectManager objectManagerWithBaseURL:@"http://10.6.10.121:80/CW_war"];
RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[CountResultVO class]];
[mapping mapKeyPathsToAttributes:
@"offercount", @"offercount",
@"insertCount", @"insertCount",
@"favouriteOfferCount", @"favouriteOfferCount",
@"favouriteInsertCount", @"favouriteInsertCount",
nil];
RKObjectRouter *router = [RKObjectManager sharedManager].router;
[router routeClass:[BasicUserArgVo class] toResourcePath:@"/getMyOffersCount" forMethod:RKRequestMethodPOST];
[RKObjectManager sharedManager].objectStore = [RKManagedObjectStore objectStoreWithStoreFilename:@"objStore.sqlite"];
RKObjectMapping *listMapping = [RKObjectMapping mappingForClass:[BasicUserArgVo class]];
[listMapping mapKeyPath:@"userId" toAttribute:@"userId"];
[listMapping mapKeyPath:@"mode" toAttribute:@"mode"];
[[RKObjectManager sharedManager].mappingProvider addObjectMapping:listMapping ];
[[RKObjectManager sharedManager].mappingProvider setSerializationMapping:[listMapping inverseMapping] forClass:[BasicUserArgVo class]];
[[RKObjectManager sharedManager] setSerializationMIMEType:RKMIMETypeJSON];
//NSUTF8StringEncoding
[[RKObjectManager sharedManager] setAcceptMIMEType:RKMIMETypeJSON];
BasicUserArgVo *bvo = [[BasicUserArgVo alloc] initWithUserId:5];
[[RKObjectManager sharedManager] postObject:bvo mapResponseWith:mapping delegate:self];
}
- (void)objectLoader:(RKObjectLoader*)objectLoader didLoadObjects:(NSArray*)objects {
CountResultVO* cvo = [objects objectAtIndex:0];
NSLog(@"values:%ld,%ld,%ld,%ld",[cvo offercount],[cvo insertCount],
[cvo favouriteOfferCount],[cvo favouriteInsertCount] );
}
- (void)objectLoader:(RKObjectLoader *)objectLoader didFailWithError:(NSError *)error {
NSString *msg = [NSString stringWithFormat:@"Error: %@", [error localizedDescription]];
NSLog(@"log : %@",msg);
}
@end