1

I'm working on test automation for an app. I'm looking for a way to automate connectivity tests. For that I need to be able to toggle 3G and wifi. I've been going through the private api headers but I haven't found a method that would scream 'I do that!'.

Can anyone point me in the right direction, please?

Rad
  • 11
  • 1
  • 2
  • Check out this - [Is there a way to toggle bluetooth and/or wifi on and off programatically in iOS?](http://stackoverflow.com/q/4518406/194544) – beryllium Feb 23 '12 at 14:43
  • Thanks for the reply. I've seen it already. It only shows bluetooth, our app doesn't use it. Ideally I'd like to be able to toggle 3G and wifi independently. But even going to airplane mode would help a lot. – Rad Feb 23 '12 at 14:50

2 Answers2

1

I can't see this being possible. The iPhone 4 has a setting for 3g on or off in iOS 5, but the iPhone 4s doesn't. If it was possible to turn off 3g in the iPhone 4s I think Apple would have retained that ability in iOS 5.

I assume you've seen the reachability sample code

ader
  • 5,403
  • 1
  • 21
  • 26
  • We are using the reachablity code. I can easily fake signals from it but they'll only affect code that listens for them. What about jail breaking? There are SB toggles that switch all kinds of settings on or off. Do they use some new APIs? – Rad Feb 24 '12 at 12:16
  • 1
    I don't believe you'll be able to turn 3g off on the iphone 4s (I'd like to know if you find out that you can), but maybe you could with iphone 4. How about CTRegistrationSetCellularDataIsEnabled? – ader Feb 24 '12 at 13:29
0

Thinking about this laterally, iOS connects to known WiFi hotspots when available - so you don't necessarily have to run this on the phone. You could just toggle your WiFi hotspot which you're connecting to on/off, and iOS should automatically switch (as long as any other known WiFi access points aren't in range) to 3G and WiFi respectively.

lxt
  • 31,146
  • 5
  • 78
  • 83
  • I was looking into this. Using mac as proxy and throttling the connection. We've used it for manual testing. This would be a more flexible solution, you could slow it down, increase latency, even loose packets. There's more work required and I just don't have the time. Not to mention the time required to test that solution. Making sure all fails are valid and not caused by overcomplicated solution. – Rad Feb 24 '12 at 12:35