5

I want to check if the device has a 2G or 3G connection.

I used Reachability class for network connection check.

user2864740
  • 60,010
  • 15
  • 145
  • 220
Bevan
  • 342
  • 2
  • 14
  • 2
    http://stackoverflow.com/questions/8122170/how-do-i-know-whether-my-iphone-ipad-is-connected-to-2g-or-3g – IKKA Nov 18 '13 at 07:40
  • you should refer this link...http://stackoverflow.com/questions/9561253/checking-cellular-network-type-in-ios – IKKA Nov 18 '13 at 07:50

1 Answers1

11

In iOS 7 Apple provided a new way to get it.

Please read this link. The "Know your Radio" section.

The basic idea is to use the new

currentRadioAccessTechnology

added to the CTTelephonyNetworkInfo class. If you want to get notified everytime the connection changes you can listen for:

CTRadioAccessTechnologyDidChangeNotification

Heres a code snippet took from the provided link:

CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new];
NSLog(@"Current Radio Access Technology: %@", telephonyInfo.currentRadioAccessTechnology);
[NSNotificationCenter.defaultCenter addObserverForName:CTRadioAccessTechnologyDidChangeNotification 
                                            object:nil 
                                             queue:nil 
                                        usingBlock:^(NSNotification *note) 
{
    NSLog(@"New Radio Access Technology: %@", telephonyInfo.currentRadioAccessTechnology);
}];

I hope this helps you.

pdrcabrod
  • 1,467
  • 1
  • 14
  • 22
  • 3
    When you link to articles, please also cite the most important parts because links tend to become dead after some time. Also, you might add this information to [another question as well](http://stackoverflow.com/questions/8122170/how-do-i-know-whether-my-iphone-ipad-is-connected-to-2g-or-3g). – DarkDust Nov 18 '13 at 07:48
  • @pdrcabrod it will return --> Current Radio Access Technology: (null) – Nirav Kotecha Mar 13 '18 at 06:50