Last active
December 24, 2015 02:19
-
-
Save fernandolopes/6730224 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @implementation Cliente | |
| +(RKObjectMapping *)clienteResponseMapping{ | |
| RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[self class]]; | |
| [mapping addAttributeMappingsFromDictionary:@{ | |
| @"id": @"clienteID", | |
| @"fbID": @"fbID", | |
| @"nome": @"nome", | |
| @"sobrenome": @"sobrenome", | |
| @"email": @"email", | |
| @"sexo": @"sexo", | |
| @"dataNascimento" : @"dataNascimento" | |
| }]; | |
| return mapping; | |
| } | |
| @end | |
| -(void) sendServerUser{ | |
| // RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:[Cliente clienteResponseMapping] objectClass:[Cliente class] rootKeyPath:@"cliente"]; | |
| //Para nessa linha | |
| RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:[Cliente clienteResponseMapping] objectClass:[Cliente class] rootKeyPath:@"clientes" method:RKRequestMethodPOST]; | |
| NSError* error; | |
| NSDictionary *parameters = [RKObjectParameterization parametersWithObject:self.cliente requestDescriptor:requestDescriptor error:&error]; | |
| // Serialize the object to JSON | |
| NSData *JSON = [RKMIMETypeSerialization dataFromObject:parameters MIMEType:RKMIMETypeJSON error:&error]; | |
| NSLog(@"%@",JSON); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment