5
votes

I am developing a view based app that requires a network connection. I want to add code so that my app gives an error when a network is not available.

I am clueless as to, whether or what code to put into the appdelegate(.h/.m) and/or viewcontroller(.h/.m)

Can anyone help me?

Thanks in advance :)

1

1 Answers

4
votes

Did you read this post?

Once you know you're offline you just might wanna show an UIAlertView.

You could integrate this code into the method application:didFinishLaunchingWithOptions: of your appDelegate.

I would not recommend to use such a feature as "test for network connectivity". The general problem with it is, that even though you might have connectivity when your app tests for it, it might be gone a little later. So I would just try to use connectivity when your app really needs to use the network and then handle error cases carefully and display meaningful messages and so on.