title | author | category | tag | excerpt | revisions | status | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Network Link Conditioner |
Mattt |
Xcode |
popular |
App developers often forget to test how their apps perform under less-than-ideal networking environments. Learn how you can use the Network Link conditioner to simulate a spotty Internet connection on your device. |
|
|
Product design is about empathy. Knowing what a user wants, what they like, what they dislike, what causes them frustration, and learning to understand and embody those motivations --- this is what it takes to make something insanely great.
And so we invest in reaching beyond our own operational model of the world. We tailor our experience to different locales. We consider the usability implications of screen readers or other assistive technologies. We continuously evaluate our implementation against these expectations.
There is, however, one critical factor that app developers often miss: network condition, or more specifically, the latency and bandwidth of an Internet connection.
For something so essential to user experience, it's unfortunate that most developers take an ad-hoc approach to field-testing their apps under different conditions (if at all).
This week on NSHipster, we'll be talking about the Network Link Conditioner, a utility that allows macOS and iOS devices to accurately and consistently simulate adverse networking environments.
Network Link Conditioner can be found in the "Additional Tools for Xcode" package. You can download this from the Downloads for Apple Developers page.
Search for "Additional Tools" and select the appropriate release of the package.
Once the download has finished, open the DMG, navigate to the "Hardware" directory, and double-click "Network Link Condition.prefPane".
Click on the Network Link Conditioner preference pane at the bottom of System Preferences.
{% error %}
When you first install Network Link Conditioner on macOS 10.14, everything works as expected. But if you close and reopen System Preferences, the preference pane no longer appears, and attempting to reinstall results in the following error message:
You can’t install the “Network Link Conditioner” preferences.
“Network Link Conditioner” preferences is installed with macOS and can’t be replaced.
As a workaround,
you can move the preference pane
from your user PreferencePanes
directory to the system-level directory
by entering the following command in Terminal.app
(you'll be prompted for your password):
$ sudo mv ~/Library/PreferencePanes/Network\ Link\ Conditioner.prefPane /Library/PreferencePanes/
Once you've done this, Network Link Conditioner will appear the next time you open System Preferences.
{% enderror %}
Enabling the Network Link Conditioner changes the network environment system-wide according to the selected configuration, limiting uplink or download bandwidth, latency, and rate of packet loss.
You can choose from one of the following presets:
- 100% Loss
- 3G
- DSL
- EDGE
- High Latency DNS
- LTE
- Very Bad Network
- WiFi
- WiFi 802.11ac
...or create your own according to your particular requirements.
![Preset]({% asset network-link-conditioner-preset.png @path %})
Now try running your app with the Network Link Conditioner enabled:
How does network latency affect your app startup?
What effect does bandwidth have on table view scroll performance?
Does your app work at all with 100% packet loss?
Although the preference pane works well for developing on the simulator, it's also important to test on a real device. Fortunately, the Network Link Conditioner is available for iOS as well.
To use the Network Link Conditioner on iOS, set up your device for development:
- Connect your iOS device to your Mac
- In Xcode, navigate to Window > Devices & Simulators
- Select your device in the sidebar
- Click "Use for Development"
![iOS Devices]({% asset network-link-conditioner-ios.png @path %})
Now you'll have access to the Developer section of the Settings app. You can enable and configure the Network Link Conditioner on your iOS device under Settings > Developer > Networking. (Just remember to turn it off after you're done testing!).