Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement network error alerts into my app?

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 :)

like image 644
Baccalad Avatar asked Oct 14 '22 17:10

Baccalad


1 Answers

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.

like image 92
Dr. Snuggles Avatar answered Oct 18 '22 01:10

Dr. Snuggles