Does iOS network visibility reach network changes when app is brought to front

I have developed an iOS 7 app. In my app I need to determine if a change has occurred in the network connection (3g \ wifi \ etc). If so, I am performing some reconnections to my services.

I couldn't figure out if reachability would be able to detect changes in the network connection as soon as the app was brought back to the foreground.

Let's assume the following scenario:

  • Application launched

  • User moves the app to the background, goes to Facebook

  • Application paused

  • User switches from 3g to wifi

  • User returns to my application

Could detecting this connection change?

+3


source to share


3 answers


I have an application that needs to be connected to WiFi and detect when an access point changes or disconnects on all view controllers that depend on it. I am using a reachability notification mechanism.

For my app, Reachability detects WiFi changes when I bring the app back to the foreground. So it does what you want it to do.



I really have to say that I have not found Reach to be 100% reliable. Most of the time it works as you'd expect, but it's not perfect.

As a backup, I check the current network in viewWillAppear

on most view controllers anyway . It doesn't help when the application is brought back to the foreground as viewWillAppear

it is not called as far as I know. However, you might find changes in the application delegate.

+2


source


Use Rechability classes where you can find all such notifications / functions. Hope it helps.



+4


source


If you understand correctly, you can check the accessibility every time your application comes to the fore, for example:

- (void)applicationWillEnterForeground:(UIApplication *)application
{
//Check the Reachability here;
}

      

0


source







All Articles