程序员

iOS - 检查网络状态

2020-05-12  本文已影响0人  biubiuboom
[[AFNetworkReachabilityManagersharedManager]setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatusstatus) {

switch(status) {

caseAFNetworkReachabilityStatusNotReachable:

//没有网

//str = @"网络不好,请稍后再试";

[DPAlertHelpershowMessage:@"网络不好,请稍后再试"time:1];

break;

caseAFNetworkReachabilityStatusReachableViaWWAN:

//手机数据

{

//[DPAlertHelper AlertWithTitle:@"提示" Message:@"您正在使用非wifi网络,确定播放" ButtonWithConfirm:@"确定" ClickConfirm:nil ButtonWithCancel:@"取消" clickCancel:^{

//[controller popoverPresentationController];

//}];

}

break;

caseAFNetworkReachabilityStatusReachableViaWiFi:

//wifi数据

{

//[DPAlertHelper AlertWithTitle:@"提示" Message:@"您正在使用非wifi网络,确定播放" ButtonWithConfirm:@"确定" ClickConfirm:nil ButtonWithCancel:@"取消" clickCancel:^{

//[controller popoverPresentationController];

//}];

}

default:

break;

}

}];

[[AFNetworkReachabilityManagersharedManager]startMonitoring];
上一篇 下一篇

猜你喜欢

热点阅读