0

i am new to iphone in my app i am connecting to database through web services it working correctly,but i want to displat alert when network connection is disable.please any help me how to alert when net connection is disable, thanks in advance.

sirisha
  • 41
  • 1
  • 1
  • 8
  • Duplicate of http://stackoverflow.com/questions/4954904/reachability-vs-uidevice-reachability and http://stackoverflow.com/questions/1861656/iphone-reachability-checking – Chetan Bhalara May 17 '11 at 07:15

3 Answers3

1

Have a look at this S.O. entry

In particular, the main point of interest for you is the first one, about using the Reachability framework to detect network connectivity.

Community
  • 1
  • 1
sergio
  • 68,819
  • 11
  • 102
  • 123
0

Use UIAlertView to display alerts

0

When you get notified by your delegate/Observer for the network disable state, you could show message in UIAlertView.

 //show an alert to let the user know that they can't connect...
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Network Status" message:@"Network is not available. Please try again later." delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
        [alert show];
        [alert release];

you could also use the Reachability API's to know the state of network connection.

iPhone SDK: Testing Network Reachability

Jhaliya - Praveen Sharma
  • 31,697
  • 9
  • 72
  • 76