I am trying to debug some inconsistent behaviour I am seeing in an application that gets its primary data from the internet. I don\'t see the issues in the simulator, just
One probably crazy idea or patch :
Just toggle the flag of network reachability
This is code which I use to toggle my flag runtime by triggering 'Simulator Memory Warning' and its COMPLETELY SAFE, just make sure code should be in DEBUG Mode only
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
#ifdef DEBUG
isInternetAvailable = !isInternetAvailable;
#endif
}
A simple solution is to create an Airplane Mode for your Mac. Here is how to do this:
When you want to turn networking back on, just select Automatic from the Location dropdown menu, and click Apply
If you have at least 2 wifi networks to connect is a very simple way is to use a bug in iOS simulator:
The bug is that simulator tries to use a network (IP?) which is not connected already.
Until you relaunched simulator- it will have no internet (even if that first wifi network you connected had internet connection), so you can run (cmd-R) and stop (cmd-.) project(s) to use simulator without connection, but your Mac will be connected.
Then, if you'll need to run simulator connected- just quit and launch it.
Download Additional tools package (Network Link Conditioner)
Description
Example in Sierra:
you could disable the network of the host instead!
Yes. In Xcode, you can go to Xcode
menu item -> Open Developer Tools
-> More Developer Tools
and download "Additional Tools for Xcode", which will have the Network Link Conditioner.
Using this tool, you can simulate different network scenarios (such as 100% loss, 3G, High latency DNS, and more) and you can create your own custom ones as well.