mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Refactored object manager API's to de-emphasize delegates and removal duplication of blocks and delegates. Added block callbacks to RKObjectLoader.
This commit is contained in:
@@ -64,6 +64,8 @@
|
||||
@synthesize timeoutInterval = _timeoutInterval;
|
||||
@synthesize reachabilityObserver = _reachabilityObserver;
|
||||
@synthesize configurationDelegate = _configurationDelegate;
|
||||
@synthesize onDidLoadResponse;
|
||||
@synthesize onDidFailLoadWithError;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
@synthesize backgroundPolicy = _backgroundPolicy, backgroundTaskIdentifier = _backgroundTaskIdentifier;
|
||||
@@ -167,6 +169,10 @@
|
||||
_OAuth2AccessToken = nil;
|
||||
[_OAuth2RefreshToken release];
|
||||
_OAuth2RefreshToken = nil;
|
||||
[onDidFailLoadWithError release];
|
||||
onDidFailLoadWithError = nil;
|
||||
[onDidLoadResponse release];
|
||||
onDidLoadResponse = nil;
|
||||
[self invalidateTimeoutTimer];
|
||||
[_timeoutTimer release];
|
||||
_timeoutTimer = nil;
|
||||
@@ -565,6 +571,10 @@
|
||||
[_delegate request:self didFailLoadWithError:error];
|
||||
}
|
||||
|
||||
if (self.onDidFailLoadWithError) {
|
||||
self.onDidFailLoadWithError(error);
|
||||
}
|
||||
|
||||
NSDictionary* userInfo = [NSDictionary dictionaryWithObject:error forKey:RKRequestDidFailWithErrorNotificationUserInfoErrorKey];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RKRequestDidFailWithErrorNotification
|
||||
object:self
|
||||
@@ -600,6 +610,10 @@
|
||||
[_delegate request:self didLoadResponse:finalResponse];
|
||||
}
|
||||
|
||||
if (self.onDidLoadResponse) {
|
||||
self.onDidLoadResponse(finalResponse);
|
||||
}
|
||||
|
||||
if ([response isServiceUnavailable]) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:RKServiceDidBecomeUnavailableNotification object:self];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user