Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

Thread: Check for Wifi?
View Single Post
Old 11-06-2008, 02:21 PM   #4 (permalink)
PhoneyDeveloper
New Member
 
Join Date: Sep 2008
Posts: 1,431
Default

I just added NetReachability.m/h to my project. I added the following code to NetReachability. I admit that this is a little cheesy. It's a one time only check but that will work correctly in many cases. I'm intending to change my code to create an instance of NetReachability and set the delgate and update my UI when the reachability status changes. Implementing the delegate callback seems simple.

Code:
+(BOOL)networkIsReachable:(BOOL)inByWiFiOnly
{
	//Make sure we have a WiFi network up & running
	NetReachability*	_reachability = [[NetReachability alloc] initWithDefaultRoute:NO];

	BOOL	result = [_reachability isReachable];
	
	if (inByWiFiOnly)
		result = result && ! [_reachability isUsingCell];

	[_reachability release];

	return result;
}
PhoneyDeveloper is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,829
Threads: 89,207
Posts: 380,639
Top Poster: BrianSlick (7,129)
Welcome to our newest member, OrvalCarrio
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:59 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.