I'm using Apple's Reachability sample code to detect network connectivity changes and wondering how one would get the accurate network status once app has returned to the foreground.
In my current visible UIViewController, I'm registering as an observer for the kReachabilityChangedNotification (same as the Reachability sample code) and also listening for UIApplicationWillEnterForegroundNotification and UIApplicationWillResignActiveNotification events.
In my current visible UIViewController, just before app suspend:
// While the app is in the foreground, I configure SCNetworkReachabilitySetCallback
// At this point, I have lost connectivity.
[reachability startNotifier];
// this returns NotReachable, as expected
NetworkStatus status = [reachability currentReachabilityStatus];
Now Suspend the app and change wifi settings (change network settings to have a connection)
After app resume: (in the UIApplicationWillEnterForegroundNotification handler)
// this still returns NotReachable even though I now have connectivity.
NetworkStatus status = [reachability currentReachabilityStatus];
Any suggestions on what I'm not doing correctly?