October 27, 2011
Every iOS app should be thoroughly tested in a variety of network conditions, from a high-bandwidth WiFi connection down to a data connection with a single measly bar of Edge or GPRS coverage. Finding a good connection is usually the easiest, you're almost guaranteed to have one at work or home, but reliably testing an intermittent or poor connection is much harder. The obvious way to do this is to take note of coverage dead spots as you go about your day and return to those locations to test the app, but that can be time consuming and unreliable. However, if you have Max OS X 10.7 you can simulate any network connection without even leaving your desk.
The Network Link Conditioner is preference pane bundled with the Lion-specific version of
Xcode (available on the Mac
App Store) and can be activated by launching it from /Applications/Utilties/Network
Link Conditioner/Network Link Conditioner.prefpane
. The preference pane allows you
to choose a connection profile from a variety of presets or create your own with custom
parameters.
I recently used the Conditioner to test an app that tweaks API call timeout values based on the quality of the network connection as reported by Reachability. For example, the timeout was doubled when the device was using an AT&T Edge connection, but I couldn't directly test it because there was full 3G coverage for miles in every direction. The "Edge, Lossy Network" preset let me test that the timeout value was correctly applied and that it was sufficient for sending a data-heavy API call.
Before you declare an app fully tested, you should certainly want to test using a real EDGE/3G/WiFi connection, however the Network Link Conditioner can help you save time while initially developing and debugging from your desk.