清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
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;
}