Search code examples
iosobjective-crestkitrestkit-0.20

Get current reachability state with RestKit 0.20


So I'm using RestKit 0.20.0 and getting reachability changes via this block:

[objectManager.HTTPClient setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
    if (status == AFNetworkReachabilityStatusNotReachable) {
        self.isConnectedToInternet = NO;
    }
    else {
        self.isConnectedToInternet = YES;
    }
}];

I'm storing the state with a property called isConnectedToInternet, but this is only getting set when reachability changes. I don't see a method or property on the RKObjectManager or the AFNetworking version that RestKit uses in order to just get current reachability state, like this:

[AFNetworkReachabilityManager sharedManager].reachable

Any ideas?


Solution

  • See

    @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus
    

    On the AFHTTPClient.