iPhone Simulator - Simulate a slow connection?

Chris picture Chris · Apr 7, 2010 · Viewed 57.9k times · Source

Is there a way to slow down the internet connection to the iPhone Simulator, so as to mimic how the App might react when you are in a slow spot on the cellular network?

Answer

Alan H. picture Alan H. · Dec 8, 2014

How to install Apple’s Network Link Conditioner

These instructions current as of October 2019.

Warning: If you just upgraded to new version of macOS, make sure you install the very latest Network Conditioner (in Additional Tools for Xcode) or it may silently fail; that is, you will turn it on but it won’t throttle anything or drop any packets.

Update: As of Xcode 11, there may be an even simpler way to simulate network conditions on tethered devices; see this blog post. For how to affect simulated devices, continue below, as before.

  1. Install Xcode if you don’t have it.

  2. Open Xcode and go to Xcode › Open Developer Tool › More Developer Tools…

    Screen shot of navigating the menu as described

  3. Download Additional Tools for Xcode (matching your current Xcode version)

    Additional IO Tools download link

  4. Open the downloaded disk image and double-click the Network Link Conditioner .prefpane under “Hardware” to install it.

    pref pane in DMG

    system preferences showing installation prompt

  5. There we go!

    Screen shot of the preference pane

  6. Be sure to turn it on. You need to select a profile and enable the network conditioner with the big toggle that should be familiar from the Time Machine prefpane.

    enter image description here

Caveat

This won't affect localhost, so be sure to use a staging server or co-worker's computer to simulate slow network connections to an API you’re running yourself. You may find https://ngrok.com/ helpful in this regard.