How do i teel if someone has network coverage

Bakersville
Bakersville used Ask the Experts™
on
Hi all

I have a UIWebView within my app i am writing and i was wondering if there was a way of writing in a bit of code that would tell me (So i can do something else), if there is no network coverage for the iphone.

I have search the web, but the only thing i found was

-(void)webView (UIWebView *)webView didFailLoadWithError:(NSError *)error
{
}

But it seems to not work.

Many thanks

Baker
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
This is good enough.
Add this code inside:
UIAlertView *alert = [[UIAlertView alloc]  initWithTitle:@"Connection Error"
     message:@"Connection failure." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];

Here is a sample from Apple:
http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

Here is one more example (SBUsesNetwork):
How to Detect Network Availability in apps
http://iphone.keyvisuals.com/code-snippets/how-to-detect-network-availability-in-apps/

Author

Commented:
Thank you for you help.

The zip files links don't work on
http://iphone.keyvisuals.com/code-snippets/how-to-detect-network-availability-in-apps/

But if you are sure that the top will work, i will just use that.  

Thank you again for you help.

Baker

Author

Commented:
Very much appreciated.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial