Suggestion: Turn off Wifi in Simulator

Every now and then I and other developers need to test reachability on our apps and with that we throw custom errors when a internet connection use case is met. I feel like we should be able to through the simulator turn off wifi virtually without having to turn it off on our work environment.

Post not yet marked as solved Up vote post of Marlon Henry Down vote post of Marlon Henry
39k views

Replies

Apple doesn't normally read these forums. You should file your enhancement request using the Report Bugs link found at the bottom of each forum page.

Just playing devils advocate here but, how would that be of benefit? It takes one click on the toolbar to turn wifi off/on it would require 2 or more minimum to do the same in the simulator if such an option were available.

Because my team and I do a lot of contact via chatroom and instant messages. So while I'm offline I can miss messages, also I know the internet here at work sometimes messes up going offline and online. Also if I'm connected to a docking station, I got to unplug and everything, when a simple way to do it in Sim would be better.

Have you tried using Apple's Network Link Conditioner?


Part of the hardware IO tools package: https://developer.apple.com/downloads/?q=Hardware%20IO%20Tools

The first statement isn't quite true for this forum atleast. I read it quite regularly 😉


As for the second, statement, spot on. Please always file enhancement requests as radars rather than just forum comments. In this case, however, we already have a radar tracking this request. Unfortunately, it's not quite a simple change to make becasue the iOS Simulator processes are OS X processes. It's not that easy to stop just simulator apps from using the network.

  • but you are the mighty Apple, you can do not easy things.

Add a Comment

Sorry Jeremy. Yes you do provide some great help, mostly in this particular subforum, and it is much appreciated. But sadly you and Eskimo are the exception to the rule 😟


My main point was that I don't think it's in anybody's job description to monitor the forums and turn user posts into radars. We have to do that ourselves.

Yep, very true. I think there are a few people who monitor them, but they're mainly for escalating very very bad fires, rather than lending a helping hand.


If in doubt, file a radar. Radar numbers are cheap =)

This feature would be nice for testing error handling via reachability. As far as I can tell, the callback set via SCNetworkReachabilitySetCallback does not get called on an app running on the iOS Simulator if you turn on Wifi on your Mac (after it was previously off). This makes it harder to test error handling on the simulator.


It would be more desirable to test some of these things on the simulator. For things like Cloudkit, on a "real device" testing can be difficult (have to log in and log out constantly to test all sorts of different possibilities). Would be much easier to do on a simulator.

I agree - this would be a useful feature. Toggling the wifi on the computer messes with everything else that a developer might have going on.
Any updates on this? I would like to see this feature in the next release (call me a dreamer).

Any updates on this? Honestly its just ridiculous now to not have this option.

Yes please, this feature is still desired in 2024. The simulator has no wifi option in settings, there's no airplane mode. The developer section does not have a "Network" section. Using Network Link Conditioner to simulate 100% packet loss will not work for a remote mac I am VNC'ing into because then I loose access obviously to the simulator!

Is blocking network traffic for a specific app really that hard? isn't that precisely what Firewall's do? I'm just curious to know the details, really so I can understand the delay. Thanks! :)

I support this request. It is 2024 and testing an app's behaviour while the network is unavailable is as important as ever. Having the Simulator "simulate" flight-mode should be possible, without disconnecting one's workstation, surely...?

In case it helps anyone, I was able to work around this by running Browsermob-proxy on our CI machine that hosts the simulator, and setting the OS-level proxy settings to go through that. Then, I use curl commands (and/or translated them into Swift code) to tell browsermob to blacklist/whitelist access to resources. Now, during our automated tests, we can effectively simulate an internet connection going up and down when trying certain actions.

This is really insane we don't have option for that.