How to fake network connection type changes in iOS simulator?
Asked Answered
T

2

10

I would like to test my iOS application with all the network conditions possible, including quality of the connection (offline, poor, good) and carrier (WiFi, 3G). For the former, others have already suggested using the Network Link Conditioner, e.g. here:

iPhone simulator - simulate 3G connection

which is just fine for the bandwidth and packet loss, but unfortunately it isn't able to change the carrier type that is reported to the simulator. So I'm looking for a not-so-hacky way of simulating changes in the carrier type. I said not-so-hacky because I have already come up with a hacky solution which, moreover, is incomplete as it can only deceive code which explicitly depends on Apple's famous Reachability module. (Though if anyone is interested, I can post it here.)

Is there a way to hijack/tamper with what the SystemConfiguration API reports?

Tiatiana answered 22/6, 2012 at 10:14 Comment(0)
E
2

I use the excellent OHHTTPStubs library to test these things.

You even specify the types of connections you want to mock and their speed. And it's easy to create mock network returns in the tests. Which means you're not testing across an actual network so your tests are more determinate.

Encircle answered 10/1, 2014 at 13:19 Comment(0)
B
-1

Use the Network Link Conditioner that the Xcode tools provides

install it using this: Installing Apple's Network Link Conditioner Tool

Benelux answered 10/1, 2014 at 15:47 Comment(2)

© 2022 - 2024 — McMap. All rights reserved.