Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check network 2G or 3G in IOS? [duplicate]

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

I used Reachability class for network connection check.

like image 569
Bevan Avatar asked Nov 18 '13 07:11

Bevan


People also ask

How do I check my network on iOS?

To find detailed network information:From the main screen of your device, look for and open Settings. With Settings open, select the Wi-Fi field. Select the Information icon next to your Wi-Fi network.


1 Answers

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.

like image 109
pdrcabrod Avatar answered Oct 06 '22 21:10

pdrcabrod