> On Apr 28, 2015, at 5:49 PM, Jens Alfke <j...@mooseyard.com> wrote: > > SCNetworkReachability is returning weirdly wrong results in an iOS app I’m > debugging. I’m running the app in the iOS Simulator (Xcode 6.3.1, iOS 8.3) > and simulating offline mode by turning off WiFi on my Mac*. But the > reachability values I’m getting don’t make any sense. > > The code is adapted from code I’ve been using for years, so I pretty much > trust it. It creates the ref with SCNetworkReachabilityCreateWithName (using > a FQDN), then schedules it on a dispatch queue. > > First I turn off WiFi and launch the app. My SCNetworkReachabilityCallBack > function is called and logs: > Reachability change: (target=0x7ff53a093a30, info=0x7ff53a0939b0, > flags=0007) > The flags indicate Transient connection + Reachable + Connection required. > That’s wrong — it implies something like PPP or a VPN is available that would > make the host reachable.
Do you have a Bluetooth Modem (BT-DUN) network service configured? That’s the most common case where you’d see the kSCNetworkReachabilityFlagsConnectionRequired flag on the desktop (and the _Sim that bleeds through the host network services). > Then when I turn WiFi back on, the callback logs: > Reachability change: (target=0x7ff53a093a30, info=0x7ff53a0939b0, > flags=0000) > That of course means Unreachable, which is completely wrong. This is a known _Sim bug. > I haven’t yet had a chance to try this with a real device. > > —Jens > > PS: Re. earlier discussions, I’m not using Reachability to determine whether > or not to connect. It’s being used after there’s an error connecting to the > host, with the intent of cutting short the retry interval and immediately > retrying the connection when the host becomes reachable. But it’s not even > working for that :( > > * If the Simulator has menu items to do things like trigger iCloud sync and > change the fake geo location, why doesn’t it have menu commands to simulate > losing the network? There isn’t even an Airplane Mode toggle in the > simulator’s Settings app. I’ll file a Radar. > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/macnetworkprog/ajn%40apple.com > > This email sent to a...@apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to arch...@mail-archive.com