Wednesday, 18 September 2013

didReceiveResponse delegate method in Restkit 0.20

didReceiveResponse delegate method in Restkit 0.20

I am using Restkit 0.20 for my project. I make a request like this.
NSData *postData = [params dataUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:baseUrl];
NSMutableURLRequest *request = [NSMutableURLRequest
requestWithURL:[NSURL URLWithString:path relativeToURL:url]];
[request setHTTPMethod:@"POST"];
[request setValue:@"application/json"
forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
RKObjectManager *manager = [[RestKit sharedDataManager] objectManager];
RKManagedObjectRequestOperation *operation = [manager
managedObjectRequestOperationWithRequest:request
managedObjectContext:manager.managedObjectStore.persistentStoreManagedObjectContext
success:^(RKObjectRequestOperation *operation1, RKMappingResult
*mappingResult) {
block ([mappingResult array]);
} failure:^(RKObjectRequestOperation *operation1, NSError *error) {
RKLogDebug(@"Failure %@",error.debugDescription);
block (error);
}];
After competing mapping operation, i am returning an array using block. Is
there any method similar to didReceiveResponse in Restkit0.10 and also i
am aware of this thread
https://groups.google.com/forum/#!topic/restkit/TrWH5GR-gFU in which blake
mentioned that we have full control over the headers via the NSURLRequest
object.But how can i make use of NSURLRequest when i am using
RKManagedObjectRequestOperation. can anyone post some example.
Thanks

No comments:

Post a Comment