iOS检测是否有网络连接
1个回答
2016-04-15 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
要引入AFNetworkReachabilityManager
AFNetworkReachabilityManager *networkJudge = [AFNetworkReachabilityManager sharedManager];
[networkJudge startMonitoring];
[networkJudge setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
if (status == AFNetworkReachabilityStatusNotReachable && [YShareModel shareInstance].remindNetwork) {
alert = [[UIAlertView alloc] initWithTitle:@"通知" message:@"网络连接已断开" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}else if (status != AFNetworkReachabilityStatusNotReachable) {
[alert dismissWithClickedButtonIndex:0 animated:YES];
}
}];
AFNetworkReachabilityManager *networkJudge = [AFNetworkReachabilityManager sharedManager];
[networkJudge startMonitoring];
[networkJudge setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
if (status == AFNetworkReachabilityStatusNotReachable && [YShareModel shareInstance].remindNetwork) {
alert = [[UIAlertView alloc] initWithTitle:@"通知" message:@"网络连接已断开" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}else if (status != AFNetworkReachabilityStatusNotReachable) {
[alert dismissWithClickedButtonIndex:0 animated:YES];
}
}];
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,IP...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询