Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @interface LoginRequest : NSObject
- {
- NSString* _deviceId;
- }
- @property (nonatomic, retain) NSString* deviceId;
- @end
- objectManager.serializationMIMEType = RKMIMETypeFormURLEncoded;
- RKObjectMapping* pmsg = [RKObjectMapping mappingForClass:[NSMutableDictionary class]];
- [pmsg mapKeyPath: @"deviceId" toAttribute:@"DeviceId"];
- RKObjectMapping* pmsgSerializeMapping = [pmsg inverseMapping];
- [objectManager.mappingProvider setSerializationMapping:pmsgSerializeMapping forClass:[LoginRequest class]];
- [objectManager.router routeClass:[LoginRequest class] toResourcePath:@"/login" forMethod:RKRequestMethodPOST];
- *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LoginRequest 0x8c9c980> valueForUndefinedKey:]: this class is not key value coding-compliant for the key DeviceId.'
- RKObjectManager *objectManager = [RKObjectManager sharedManager];
- LoginRequest* request = [LoginRequest alloc];
- request.deviceId = @"Test";
- [objectManager postObject:request delegate: self];
- RKObjectMapping* pmsg = [RKObjectMapping mappingForClass:[NSMutableDictionary class]];
- [pmsg mapAttributes:@"DeviceId", nil];
- [objectManager.mappingProvider setSerializationMapping:pmsg forClass:[LoginRequest class]];
- [objectManager.router routeClass:[LoginRequest class] toResourcePath:@"/login" forMethod:RKRequestMethodPOST];
Add Comment
Please, Sign In to add comment