使用Reachability检测网格


#pragma mark - 网络连接检查
- (void) currentReach
{
    //  网络检测
    Reachability *curReach = [Reachability reachabilityForInternetConnection];
    
    switch ([curReach currentReachabilityStatus]) {
        case NotReachable:
            
            [BlockView getToastWithContent: @"无法连接网络!" target: self.window];
            
            break;
        case ReachableViaWiFi:
            
            [BlockView getToastWithContent: @"Wifi已连接!" target: self.window];
            
            break;
        case ReachableViaWWAN:
            
            [BlockView getToastWithContent: @"3G上网中" target: self.window];
            
            break;
        default:
            break;
    }
    
}


原文地址:https://www.cnblogs.com/jz319/p/3779992.html