-1

I want to get the technology of radio access (internet connection), so detect if the device is connected to Wifi or WWAN connection (and in this case, which type of WWAN : GPRS, EGDE, 3G, 3G+, 3G++, or 4G).

Does CTTelephonyNetworkInfo works for iPhone and iPad on iOS7.1 ?

I've tried to detect a Wifi connection on an iPad but I print a null result. This is my code :

CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new];
NSLog(@"Current Radio Access Technology: %@", telephonyInfo.currentRadioAccessTechnology);

Someone can told me why ? I'm not sure to understand everything about this...

Thanks for your help

(Source : http://www.objc.io/issue-5/iOS7-hidden-gems-and-workarounds.html, section "Know your Radio")

emilien-io
  • 13
  • 6

1 Answers1

1

That's because currentRadioAccessTechnology will return the radio access technology (not whether it's Wifi or WWAN). An example of return value is CTRadioAccessTechnologyLTE.

To get informed about whether your app is connect to Wifi or WWAN, you should use Reachability.

There are several implementations available.

Community
  • 1
  • 1
Marcelo
  • 9,916
  • 3
  • 43
  • 52
  • 1
    And if I want to know if this WWAN connection is GPRS, EDGE, 3G, 3G or something else ? I guess these implementations allows me to make a distinction between Wifi and WWAN connection, no ? – emilien-io Jun 24 '14 at 12:40
  • You'd need to use both of them: Reachability to know if it's a WWAN connection, then `- [CTTelephonyNetworkInfo currentRadioAccessTechnology]` to know what kind of WWAN it is. – Marcelo Jun 24 '14 at 12:48
  • 1
    Seems to be logic... Thanks for your help ! – emilien-io Jun 24 '14 at 12:51
  • While this detects which WWAN connection is supported, it won't tell you if it's actually using it. So say I have an iPhone capable of LTE, but if I'm in an area with 3G only, it'll still report LTE. – Adam W. Dennis Jul 22 '14 at 16:09