网络判断

//网络判断
/*
	法一
	http://www.th7.cn/Program/IOS/2012/03/01/61663.shtml
*/

-(NSString *)GetCurrentNet{
	NSString *result;
	Reachability *r = [ReachabilityreachailityWithHostName:@"www.apple.com"];
	switch([r currentReachabilityStatus]){
		caseNotReachable:
			result = nil;
			break;
		caseReachableViaWWAN:
			result = @"3G";
			break;
		caseReachableViaWiFi:
			result = @"WiFi";
			break;
	}
	return result;
}

/*
	法二
	http://www.cocoachina.com/iphonedev/sdk/2011/0516/2856.html
*/
 

你可能感兴趣的:(网络)