I am using RestKit 0.10.1 with basic data for the purpose of deploying iOS 5.0 to create an application that interacts with a custom RESTFul API. Since autonomous communication is important, I maintain a cache of user data in the local CoreData database on the device.
RestKit is now quite awesome, and it was pretty easy to set up the RKFetchResultsTableController to easily display and save my data. However, there is one RestKit behavior that does not seem ideal, and I cannot figure out how to change it.
I have a model called Record. To create a new entry, I do the following:
Recording *r = [NSEntityDescription insertNewObjectForEntityForName:@"Recording" inManagedObjectContext:[[RKObjectManager sharedManager].objectStore managedObjectContextForCurrentThread]];
r.name = newName;
[[RKObjectManager sharedManager] sendObject:r toResourcePath:@"/recordings" usingBlock:^(RKObjectLoader *loader){
loader.delegate = self;
loader.method = RKRequestMethodPOST;
loader.serializationMIMEType = RKMIMETypeJSON;
loader.serializationMapping = [RKObjectMapping serializationMappingUsingBlock:^(RKObjectMapping *serializationMapping){
[serializationMapping mapAttributes:@"name", nil];
}];
RBMappingProvider *mappings = (RBMappingProvider *)[[RKObjectManager sharedManager] mappingProvider];
loader.objectMapping = [mappings recordingObjectMapping];
}];
"", POST. .
, , . , , , Core Data 0 ( - , ).
- .
2xx? , , , 2xx?
,