-
ios-基于Reachability扩展的2G3G4G 网络检测,支持block回调.zip下载
资源介绍
NetWorkSatusType type = [[RYPreferanceManager sharePreferanceManager]currentNetStatusType];
switch (type) {
case NetWorkSatusType_None:
{
self.currentNetWorkStatus.text = @"无网络连接";
NSLog(@"没有网络");
}
break;
case NetWorkSatusType_WiFi:{
self.currentNetWorkStatus.text = @"当前连接是WiFi";
NSLog(@" current net is wifi");
}
break;
case NetWorkSatusType_2G:{
self.currentNetWorkStatus.text = @"当前使用的是2G网络";
NSLog(@" current net is 2g");
}
break;
case NetWorkSatusType_3G:{
self.currentNetWorkStatus.text = @"当前使用的是3g网络";
NSLog(@" current net is 3g");
}
break;
case NetWorkSatusType_4G:{
self.currentNetWorkStatus.text = @"当前使用的是4G网络";
NSLog(@" current net is 4g");
}
break;
case NetWorkSatusType_5G:{
NSLog(@" current net is 5g 暂时还未找到支持5G的API");
}
break;
default:
break;
}
[[RYPreferanceManager sharePreferanceManager]getReachablityStatusWithChangeBlock:^(NetWorkSatusType status) {
if (status==NetWorkSatusType_WiFi) {
self.changeLable.text =[NSString stringWithFormat:@"当前是wifi %@",@(status)];
}else{
self.changeLable.text =[NSString stringWithFormat:@"当前无网络 %@",@(status)];
}
NSLog(@"current net status = %@",@(status));
}];
github : https://github.com/pengleelove/RYNetWorkManager.git
- 上一篇: ios Reachability
- 下一篇: iOS_Reachability