获取手机的网络类型
#pragma mark - 获取手机的网络类型 - (NSString *)getNetconnType{ NSString *netconnType = @""; Reachability *reach = [Reachability reachabilityWithHostName:@"www.apple.com"]; switch ([reach currentReachabilityStatus]) { case ReachableViaWiFi:// Wifi { netconnType = @"WIFI"; } break; case ReachableViaWWAN:// 手机自带网络 { // 获取手机网络类型 CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init]; CTCarrier *carrier = [info subscriberCellularProvider]; NSString *name = [carrier carrierName]; if ([name isEqualToString:@"中国移动"]) { netconnType = @"MOBILE"; }else if ([name isEqualToString:@"中国电信"]){ netconnType = @"TELECOM"; }else if ([name isEqualToString:@"中国联通"]){ netconnType = @"UNICOM"; } } break; default: break; } return netconnType; }