Re: Reachability sample app
Re: Reachability sample app
- Subject: Re: Reachability sample app
- From: Jens Alfke <email@hidden>
- Date: Fri, 31 May 2013 13:56:55 -0700
On May 31, 2013, at 1:14 PM, Rick Mann <email@hidden> wrote:
> Running in the simulator, if I turn off WiFi, only the remote host status changes. If I quit and re-launch it with WiFi disabled, I get the same result.
> If I then re-enable WiFi, only "local WiFi" shows as unavailable, until I re-launch.
> In no case does it seem to reliably update while running.
> Is this a simulator issue? Or is SCNetworkReachability not reliable?
Pretty sure it’s a simulator issue. I’ve used SCNetworkReachability a lot and it’s reliable at what it does.
I suspect what’s happening is that the simulator runs behind some kind of imaginary router that in turn connects to your real network interface. If that’s true, then if you turn off WiFi on your Mac, from the simulator’s point of view that would be an upstream network change that it won’t see directly; the LAN it thinks it’s on is the one provided by that imaginary router.
(It would be as though you set up Internet Sharing on your Mac to share an Ethernet connection, and then connected your iPhone to that WiFi network: if you do that and then unplug your Mac’s Ethernet, the iPhone won’t detect the change because its own LAN (WiFi) is still up. All it can tell is that packets it sends to the outside world never get responses, and that’s not the kind of thing that SCNetworkReachability can or will tell it about.)
I don’t know this for sure, though. (And I think the people who would know are on the macnetworkprog list, not necessarily cocoa-dev.) But try your app on a real device and you should get better results.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden