Re: iPhone Testing Internet Connection?
Re: iPhone Testing Internet Connection?
- Subject: Re: iPhone Testing Internet Connection?
- From: David Duncan <email@hidden>
- Date: Tue, 15 Dec 2009 09:20:17 -0800
On Dec 15, 2009, at 4:25 AM, Chunk 1978 wrote:
> i have been researching how to do this, and while i believe my code is
> correct, i always receive the alert stating the internet connection is
> unavailable. what am i doing wrong?
Don't use Reachability synchronously. At some point you will be blocked, you will hit a watchdog timer, and your application will be killed.
The current reachability sample correctly demonstrates how to use Reachability asynchronously, but most importantly it continuously updates you on the current state of the network, so you can properly adapt to changes (such as when the train the user is on goes into a tunnel and the network goes down).
In your particular case, it would allow you to disable or hide the button when the network is down, rather than displaying an alert when the user tries to use it.
You can find the sample here: <http://developer.apple.com/iphone/library/samplecode/Reachability/index.html>
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden