CDNetworkReachability 1.0.1

CDNetworkReachability 1.0.1

Maintained by cqzhong.



  • By
  • cqzhong

CDNetworkReachability

CI Status Version License Platform

Requirements

  • Xcode 7 or higher
  • iOS 8.0 or higher
  • ARC

Installation

CDNetworkReachability is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CDNetworkReachability'

使用方法

  • 开启监测
CDNetworkReachability *reachability = [CDNetworkReachability manager];
//[CDNetworkReachability reachabilityWithHostName:@"www.baidu.com"];
[reachability startNotifier];
  • 检测网络权限
[[CDNetworkReachability manager] checkNetworkPermissionsEvent:^(CDNetworkAuthorizationStatus status) {

if (status == CDNetworkAuthorizationRestricted) {
//没有网络授权

}
}];
  • 获取当前网络状态
[reachability currentReachabilityStatus];
  • 网络状态发生变化的回调
[[CDNetworkReachability manager] setReachabilityStatusChangeBlock:^(CDNetworkStatus status) {

}];

Author

cqzhong, [email protected]

License

CDNetworkReachability is available under the MIT license. See the LICENSE file for more info.