This content originally appeared on DEV Community and was authored by Tarik Dahic
Network Link Conditioner is a network utility tool provided by Apple that can simulate various network conditions and help us to develop better apps. If you ever received a bug report where user mentioned slow network connection the Network Link Conditioner will help you to reproduce that issue.
We are always on the go, using our mobile devices in different places with different network conditions and we need to adjust the apps that we develop for that conditions. For example, the elevators are ruthless, somehow the app that I work on has always issues with them! 😀
Installation
Network Link Conditioner is available on iOS and macOS and in this article I will cover how to install and use it on both platforms.
iOS
To enable Network Link Conditioner on iOS device you will need to enable that device for development. You can do that by connecting and building the app directly to your device. If your device is not enabled for development, Xcode will do that before building and installing your app.
The other option is to go to Window → Devices and Simulators in Xcode and from there select your device and enable it for development.
Inside the Settings app you will now have a Developer section and inside that section you will be able to use Network Link Conditioner.
macOS
You will need to go to more downloads page on the Apple Developer portal to and search for appropriate Additional Tools for your Xcode version. This link will take you directly to those search results. Download the dmg
file, open it, and inside Hardware folder you will find the file called Network Link Conditioner.prefPane
.
Double click on it to install it and when the installation is completed you can open the Network Link Conditioner by going to the Settings app and at the bottom of the window you will find it.
How to use
Network Link Conditioner comes with a lot of presets that you can use like 3G, Edge, Very Bad Network, LTE, 100% Loss and more. They are great for testing your app on bad network conditions and in most cases you will not need to create custom presets (profiles).
To use it, pick a preset and just flip the switch to enable it. It is that easy, but don’t forget to turn it off after you are done with testing because it is applied on the entire system.
Every preset has following:
- Downlink bandwidth, packet drop rate and delay in ms
- Uplink bandwidth, packet drop rate and delay in ms
- DNS Delay
By tweaking these attributes you can simulate a lot of different network conditions.
Edge is a great preset to see how your app behaves on very slow networks. Very Bad Network preset is great when you want to test that you have connection to the Internet but that it is very unreliable.
I am working with VoIP and I have found that custom profile with 60% packet loss in both directions is very great for testing reconnection and recovery mechanisms.
If you are using iOS Simulator you will need to install the Network Link Conditioner on macOS and apply it to entire system. This will affect the connection of your entire macOS.
Here’s a little trick that I use for uploading. When I need to upload a large file and I don’t want to make my home network unusable I just turn on Network Link Conditioner with custom profile that limits my upload speed. It is configured like this:
Network Link Conditioner is a very useful tool and if you are not using it to test your apps your users might suffer! If you have any questions, please post them in the comments below.
This content originally appeared on DEV Community and was authored by Tarik Dahic
Tarik Dahic | Sciencx (2021-11-04T19:53:57+00:00) Using Network Link Conditioner to simulate bad network conditions on iOS and macOS. Retrieved from https://www.scien.cx/2021/11/04/using-network-link-conditioner-to-simulate-bad-network-conditions-on-ios-and-macos/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.