// 要用到Reachability.h 和Reachability.m两个文件 -(void)checkNetworkRun { NSLog(@"newtwork44"); SchoolInHandAppDelegate *app = [[UIApplication sharedApplication]delegate]; Reachability *r = [Reachability reachabilityWithHostName:@"www.apple.com"]; switch ([r currentReachabilityStatus]) { case NotReachable: //[self alertNONetwork]; 网络弹出提示 app.moudle.NetworkYesOrNo = NO; NSLog(@"没有网络"); break; case ReachableViaWWAN: app.moudle.NetworkYesOrNo = YES; NSLog(@"正在使用3G网络"); break; case ReachableViaWiFi: app.moudle.NetworkYesOrNo = YES; NSLog(@"正在使用wifi网络"); break; default: break; } }
iOS 网络检查
最新推荐文章于 2017-07-28 12:19:00 发布