calling SCNetworkReachabilityGetFlags in iOS16 does not return the correct flags as expected

Hi

I just encountered an reachability detection problem by calling SCNetworkReachabilityGetFlags function in iOS 16.

what did I do:

on device iPhone 12, iOS 16.1.1, turn on Airplane Mode, call SCNetworkReachabilityGetFlags, got flags = kSCNetworkReachabilityFlagsTransientConnection | kSCNetworkReachabilityFlagsReachable

on device iPhone 7, iOS 14.5.1, turn on Airplane Mode, call SCNetworkReachabilityGetFlags, got flags = 0

what I expect:

I'm expecting SCNetworkReachabilityGetFlags on my iOS 16.1 device behave same as my iOS 14.5 device, returning flags = 0. It's inappropriate returning kSCNetworkReachabilityFlagsReachable in this case.

Thank you!

What are you doing this these flags?

We generally discourage folks from using SCNetworkReachability. It’s not that the API is broken — well, in this case it might be (-: — but rather than the whole concept is fundamentally suspect. The only way to tell whether you can talk to someone across the Internet is to try it.

Which isn’t to say that there are no valid uses cases for reachability. But in order to get you on the right path I need to understand your final goal.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

calling SCNetworkReachabilityGetFlags in iOS16 does not return the correct flags as expected
 
 
Q