In iOS development, it is necessary to do test processing for different network conditions. But I find that there are still some iOS developers who are not very aware of debugging problems in different network environments, or how to debug this situation.
Below I will make a brief description of the real machine and the simulator respectively. Tell us how to simulate different network conditions.
1. Real-computer situations
In fact, Apple has a network debugging tool provisioned on the iOS system, but only if the test device has been added and the device is connected using Xcode to activate.
Just go to the settings and you can see the extra one: developer
Watch the middle line. NETWORK LINK Conditioner
The Status in indicates whether the network restrictions are turned on, click to see the detailed settings
You can see the network conditions of the system default configuration are still many, where:
100%loss is all lost,
3G This everybody should know
DSL is a telephone line to the Internet,
Edge is a 2G network,
High Latency DNS is highly latency,
Very bad network is unstable.
And at the bottom there is an option to add additional configuration to customize network conditions.
PS: after this opening the whole system is affected. , so do not forget to switch off after debugging, lest the strange network state is not normal ...
2. Simulator
Because the simulator is on the computer, the MAC also has the same debugging tools as the iOS device and is included in the Apple tools. Similarly, this tool also affects the entire system.
Read MORE: http://nshipster.com/network-link-conditioner/
Apple official address for this tool: https://developer.apple.com/downloads/index.action?q=Network%20Link%20Conditioner#
Specific steps:
Download:
Open the DMG file, which contains a lot of debugging tools, other tools are interested to see for yourself. Here we only open the network Link conditioner.prefpane this file
There are tools in System Preferences:
Open the tool and look at it, almost the same as on the phone.
At last:
Hope that you read this article, can better do a variety of application debugging, to develop a more stable and reliable application.
iOS Development Debug Network speed limit