简体   繁体   English

使用RestKit 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: 所以我正在使用RestKit 0.20.0并通过此块获得可访问性更改:

[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. 我正在使用名为isConnectedToInternet的属性存储状态,但只有在可达性更改时才会设置此状态。 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: 我没有看到RestKit使用的RKObjectManager或AFNetworking版本上的方法或属性,以便获得当前的可达性状态,如下所示:

[AFNetworkReachabilityManager sharedManager].reachable

Any ideas? 有任何想法吗?

See 看到

@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus

On the AFHTTPClient . AFHTTPClient

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM