[[RKObjectManager sharedManager] getObjectsAtPath:@"/mypath/objects" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
// Use objects that are returned.
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
// Handle error
}];
This method of RestKit will perform a request, mapping, saving to core data, and performing the success callback AFTER saving. What I want to know is the method I can use to get the response and perform a callback BEFORE RestKit automatically saves it in core data. I still want to be able to use the ability of RestKit to do the mapping and saving but I want to intercept or at least get a callback BEFORE it performs saving of data.
I found a way to do it by implementing the callback block of the RKManagedObjectRequestOperation before the mapping begins since this will be called after a successful HTTP response and before the automatic saving to core data:
[managedObjectRequestOperation setWillMapDeserializedResponseBlock:^id(id deserializedResponseBody) {
//do something
return deserializedResponseBody;
}];