I'm using Restkit 0.10.0 and I can't figure out how to do a http post with object mapping. This is what I have so far:
baseUrl = [[NSURL alloc] initWithString:@"http://www.whatever.com"];
RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:baseUrl];
objectManager.acceptMIMEType = RKMIMETypeJSON;
objectManager.serializationMIMEType = RKMIMETypeJSON;
// mapping
RKObjectMapping * userMapping = [RKObjectMapping mappingForClass:[User class]];
[userMapping mapKeyPath:@"id" toAttribute:@"id"];
[userMapping mapKeyPath:@"g" toAttribute:@"genre"];
[[objectManager mappingProvider] addObjectMapping: userMapping];
[[RKObjectManager sharedManager].mappingProvider setMapping:userMapping forKeyPath:@"response"];
// post request
NSArray *objects = [NSArray arrayWithObjects:@"Montreal", @"Canada", @"", @"", @"", @"1", @"0", @"2", @"0", nil];
NSArray *keys = [NSArray arrayWithObjects:@"c", @"co", @"lat", @"lng", @"rad", @"s", @"o", @"ageG", @"w_ageG", nil];
NSDictionary *queryParameters = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
NSString *getResourcePath = RKPathAppendQueryParams(@"people.php", queryParameters);
// send request and wait for answer, delegate self will map objects
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/people.php" delegate:self];
When I do this post, with
$city = $_POST['c'];
in the php file for example, nothing happens. Any ideas? Thanks!