iPhone Device. Go to your Settings and go to Developer menu. Like the Network Link Conditioner in macOS, you can choose a desired profile to simulate for example a poor connection (100% Loss), or a 3G connection and so on.
Go to Settings and tap Wi-Fi. Tap the Info button next to the Wi-Fi network that you're connected to. Turn on Low Data Mode.
The simulator does a really lousy job of indicating app performance. In fact it doesn't try. For most things the simulator is much, much faster than an iOS device. It runs your code on an x86 processor, which is much faster than the ARM and has many times more memory.
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.
Install Xcode if you don’t have it.
Open Xcode and go to Xcode › Open Developer Tool › More Developer Tools…
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.
"There's an app for that!" ;) Apple provides "Network Link Conditioner" preference pane that does the job quite well.
Developer
folder, e.g. "/Developer/Applications/Utilities/Network Link Conditioner"
, after installation, if daemon fails to start and you don't want to reboot your machine, just use sudo launchctl load /system/library/launchdaemons/com.apple.networklinkconditioner.plist
Developer
folder, you can install the pane as a part of "Hardware IO Tools for Xcode" package available via Mac Dev Center additional downloads section.Link to download page (you must log in with your Apple ID): https://developer.apple.com/downloads/index.action
(credits to @nverinaud)
An app called SpeedLimit
https://github.com/mschrag/speedlimit
Works great.
chris.
It also worth mentioning that Xcode also has a built in way for devices, not simulator.
cmmd+shift+2
)To have this working you need to install 'Network Link Conditioner' on your Mac. See steps mention in Alan's answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With