我想检查设备是否有 2G 或 3G 连接.
I want to check if the device has a 2G or 3G connection.
我使用 Reachability 类进行网络连接检查.
I used Reachability class for network connection check.
在 iOS 7 中,Apple 提供了一种获取它的新方法.
In iOS 7 Apple provided a new way to get it.
请阅读此链接.了解您的收音机"部分.
Please read this link. The "Know your Radio" section.
基本思路是使用新的
当前无线电接入技术
添加到 CTTelephonyNetworkInfo 类.如果您想在每次连接更改时收到通知,您可以监听:
added to the CTTelephonyNetworkInfo class. If you want to get notified everytime the connection changes you can listen for:
CTRadioAccessTechnologyDidChangeNotification
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);
}];
我希望这对你有帮助.
这篇关于如何在IOS中查看网络2G或3G?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!