mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-06 00:23:43 +08:00
Add a modified handleTargetObject implementation from RKManagedObjectLoader to give RKObject a chance to respond to willSendWithObjectLoader.
This commit is contained in:
@@ -173,6 +173,25 @@
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
// Give the target object a chance to modify the request
|
||||
- (void)handleTargetObject {
|
||||
if (self.targetObject) {
|
||||
if ([self.targetObject respondsToSelector:@selector(willSendWithObjectLoader:)]) {
|
||||
[self.targetObject willSendWithObjectLoader:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)send {
|
||||
[self handleTargetObject];
|
||||
[super send];
|
||||
}
|
||||
|
||||
- (RKResponse*)sendSynchronously {
|
||||
[self handleTargetObject];
|
||||
return [super sendSynchronously];
|
||||
}
|
||||
|
||||
- (void)didFailLoadWithError:(NSError*)error {
|
||||
if ([_delegate respondsToSelector:@selector(request:didFailLoadWithError:)]) {
|
||||
[_delegate request:self didFailLoadWithError:error];
|
||||
|
||||
Reference in New Issue
Block a user