How to disable the network in iOS Simulator?


Sometimes while testing our app on simulator we need to test for case where no internet is available. This can be achieved in multiple ways.

Below are some of the possible ways to do it

  • Easiest but not the most correct way is to disconnect your mac from the LAN Cable is you are on a LAN, or turn off the wifi if you are connected on a wifi network. But that will definitely turn off internet for your whole device, not just simulator. So, there are some more ways to do it

  • Download Hardware IO tools for Xcode.

    • Go to Xcode menu, select open Developer tool

    • Select More Developer tools from that menu

    • This takes you to apple developer account, sign in to your account, Now if you still have Xcode older than 8.0 you need to download Hardware IO tools for xcode, other wise for new Xcode search for Additional tools for Xcode

    • Download and install this tool, then open system preferences in you mac.

    • You’ll find the tool Network link conditioner installed there, for newer xcode versions you may find it in Xcode developer tools menu.

    • Use it to control the network.

This tool will also effect speed of your mac at the same time along with the simulator.

Updated on: 27-Jun-2020

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements