[iOS 14.5 Beta] SCNetworkReachabilityFlags return kSCNetworkReachabilityFlagsTransientConnection

Hello,
I have a question that could help better understand a change in iOS 14.5 Beta, it could be a problem with this Beta.
  • For my test:

  • I am using an iPhone 11 Pro device.

  • Device connected via WIFI

  • iOS 14.2:

handling this SCNetworkReachabilityGetFlags return kSCNetworkReachabilityFlagsReachable.
When I upgraded to iOS 14.5, the result is different which became kSCNetworkReachabilityFlagsReachable | kSCNetworkReachabilityFlagsTransientConnection

Could someone explain this change to me and is it a bug with iOS 14.5?
The various kSCNetworkReachabilityFlagsXxx flags are meant to be flags, that is, you should test them in isolation. If you care about reachability, just test the kSCNetworkReachabilityFlagsReachable flag. The kSCNetworkReachabilityFlagsTransientConnection flag only matters if your care whether the connection is transient or not, which is pretty obscure.

Taking as step back, what are you using SCNetworkReachability for? [1]

Share and Enjoy

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

[1] This is, in my experience, the #1 most misused API on our platforms. That is, most folks who are using it are either using it incorrectly or using it for the wrong reasons. Thus, any time I see folks ask about reachability I always ask the WAYRTTD question.
I was among the people who misused the SCNetworkReachability, my algirithm was:
  • (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags

{
NetworkStatus status = NotReachable;

if (flags & kSCNetworkReachabilityFlagsReachable) {
if (flags & kSCNetworkReachabilityFlagsIsWWAN) {
status | = ReachableViaWWAN;
}
if (! (flags & kSCNetworkReachabilityFlagsTransientConnection)) {
status | = ReachableViaWiFi;
}
}
return status;
}
Who considers the status not reachable when I receive kSCNetworkReachabilityFlagsTransientConnection and I am reachable and not in WWAN.

Thanks for your help
So what are you trying to actually do here? I don’t see a network connection in play, so I’m presuming that this reachability instance isn’t associated with one. So what is it doing?

This matters because there are many ways to use reachability, almost all of which have better options. There’s too many options for me to enumerate them all here, but if you describe your circumstances I’m happy to suggest a better way forward.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
I wanted to know the status of the network from the received flags and be notified when this is changed.
The statuses are:
NotReachable
ReachableViaWWAN
ReachableViaWiFi

[iOS 14.5 Beta] SCNetworkReachabilityFlags return kSCNetworkReachabilityFlagsTransientConnection
 
 
Q