SCNetworkReachabilityFlags are sometimes not set correctly when a connection is lost / received

I tested the connection loss in the my application during the connection queue, and Ive noticed that I can get my application in a state where it does not correctly recognize the connection. Or they say that there is a connection when there is no or no connection, when there is.

Ive tracked the issue to the point where SCNetworkReachabilityFlags were wrong while I test the connection. And these flags remain until the connection status changes. Thus, in essence, it cannot force the application to exit the incorrect state without restarting it, or correctly set the connection notification

I'm using apple reachability.m here https://developer.apple.com/library/ios/samplecode/Reachability/Listings/Reachability_Reachability_m.html#//apple_ref/doc/uid/DTS40007324-Reachability_Reachability_m-DontLinkElementID_8

and the problem is in the 'networkStatusForFlags' method. In principle, the flag that is transmitted is incorrect. My machine running the simulator will have a WIFI connection, but the returned flag still runs on kSCNetworkReachabilityFlagsReachable.

Is there any way to solve this problem? I feel that wrong flags are an Apple kernel issue with SCNetworkReachabilityFlags, but I feel that if that were the case, that would be a more common problem.

+4

All Articles