mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-05 06:47:22 +08:00
Refactored RKReachabilityObserver to work around issues with iOS 5 + host reachability and expand its capabilities. closes #408
* Added support for monitoring by IP address or hostname as well as local Wifi and Internet access generally * Eliminated usage of synchronous calls to obtain reachability flags during status checks * Reworked SystemConfiguration reachability callback to cache flags * RKClient now monitors Internet access instead of hostname based reachability by default. baseURLReachabilityObserver eliminated in favor of reachabilityObserver. It is now a retain property that can be customized * Queue suspension is now tied to the reachability observer rather than baseURL mutation
This commit is contained in:
@@ -64,8 +64,8 @@ static RKObjectManager* sharedManager = nil;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(reachabilityChanged:)
|
||||
name:RKReachabilityStateChangedNotification
|
||||
object:_client.baseURLReachabilityObserver];
|
||||
name:RKReachabilityDidChangeNotification
|
||||
object:_client.reachabilityObserver];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -115,7 +115,7 @@ static RKObjectManager* sharedManager = nil;
|
||||
}
|
||||
|
||||
- (void)reachabilityChanged:(NSNotification*)notification {
|
||||
BOOL isHostReachable = [self.client.baseURLReachabilityObserver isNetworkReachable];
|
||||
BOOL isHostReachable = [self.client.reachabilityObserver isNetworkReachable];
|
||||
|
||||
_onlineState = isHostReachable ? RKObjectManagerOnlineStateConnected : RKObjectManagerOnlineStateDisconnected;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user