Leave a rating/review
Notes: 16. Simulate Different Network Speeds
In a previous episode, you put together a demo that showed how to display download progress to the user. However, the progress view might have updated too fast if you have really good internet. It might be easy for us to assume that everyone else shares this speed, but that’s not the case.
People have all sorts of network speeds for a variety of reasons. It’s critical that you test your app at different network speeds to see how it responds.
There are a few ways. With Xcode, you can simulate a poor network on your device. You need to tether your device to Xcode and from the devices and simulators option, you can select the type of network for the device to experience.
If you are testing on the simulator, you can also download the Network Link Conditioner tool. This plugs directly into System Preferences and allows you to change the speed of the network.
Finally, on your device itself, you can access the developer settings from the settings app.
You’ll need to connect your device to your development machine while running Xcode. When prompted, confirm the trust settings and you should see the Developer menu. From there, you simulate bad network conditions using the Network Link Conditioner.
To test different network speeds on the simulator, you’ll need to download some additional tools from Apple.
- Head over to the Apple Developer Portal’s Downloads and log in. https://developer.apple.com/download/ In the top-right corner, click More and search for Additional Tools. From the list of options, select Additional Tools for Xcode. This will be a DMG for you to download.
Once downloaded, open it up and look in the Hardware folder. You’ll find a tool called Network Link Conditioner.prefPane. Double-click on it to install it.
You’ll now see a new tool in your System Preferences. Double click it open it. This will now control the network traffic out of your computer.
In this case, I want to simulate a 3G network. I’ll turn on the conditioner and navigate to the apple.com. Notice how slow it now goes.
To simlate different network conditions on your device, make sure to plug in a device to your development computer. In Xcode, select Window and then Devices and Simulators.
Select your device and, at the bottom, you’ll see a section labeled Device Conditions. Click the dropdown and select Network Link. You’ll see that you have lots of different options to simulate. Select your option and then click Start.
And there you have it. The Network Link Condition allows you to simulate different network speeds and conditions without having to jump through hoops.
Don’t forget to turn off the tool on your Mac or iOS device, otherwise the next episodes will take forever to load!
Speaking of which, join me in the next episode where I’ll show you how to pause, resume, and cancel downloads. See ya in a bit! :)