1.添加framework:将SystemConfiguration.framework 添加进工程。2.下载https://developer.apple .com/library/ios/samplecode/Reachability/Reachability.zip复制里面的Reachability.h和R eachability.m到项目中
//判断当前的网络是3g还是wifi-(NSString*)GetCurrntNet{ NSString* result; Reachability *r = [ReachabilityreachabilityWithHostName:@'www.apple.com']; switch ([r currentReachabilityStatus]) { caseNotReachable:// 没有网络连接 result=nil; break; caseReachableViaWWAN:// 使用3G网络 result=@'3g'; break; caseReachableViaWiFi:// 使用WiFi网络 result=@'wifi'; break; } return result;}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。