SHARE
TWEET

Untitled

a guest Jan 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @interface LoginRequest : NSObject
  2. {
  3.     NSString* _deviceId;
  4. }
  5.  
  6. @property (nonatomic, retain) NSString* deviceId;
  7.  
  8. @end
  9.    
  10. objectManager.serializationMIMEType = RKMIMETypeFormURLEncoded;
  11.  
  12.         RKObjectMapping* pmsg = [RKObjectMapping mappingForClass:[NSMutableDictionary class]];
  13.         [pmsg mapKeyPath: @"deviceId" toAttribute:@"DeviceId"];
  14.  
  15.         RKObjectMapping* pmsgSerializeMapping = [pmsg inverseMapping];
  16.  
  17.         [objectManager.mappingProvider setSerializationMapping:pmsgSerializeMapping forClass:[LoginRequest class]];
  18.  
  19.         [objectManager.router routeClass:[LoginRequest class] toResourcePath:@"/login" forMethod:RKRequestMethodPOST];
  20.    
  21. *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<LoginRequest 0x8c9c980> valueForUndefinedKey:]: this class is not key value coding-compliant for the key DeviceId.'
  22.    
  23. RKObjectManager *objectManager = [RKObjectManager sharedManager];
  24.  
  25. LoginRequest* request = [LoginRequest alloc];
  26. request.deviceId = @"Test";
  27.  
  28. [objectManager postObject:request delegate: self];
  29.    
  30. RKObjectMapping* pmsg = [RKObjectMapping mappingForClass:[NSMutableDictionary class]];
  31.         [pmsg mapAttributes:@"DeviceId", nil];
  32.  
  33.         [objectManager.mappingProvider setSerializationMapping:pmsg forClass:[LoginRequest class]];
  34.  
  35.         [objectManager.router routeClass:[LoginRequest class] toResourcePath:@"/login" forMethod:RKRequestMethodPOST];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top