我想检查设备是否有 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模板网!
如何通过点击动画 UIImageview 以显示全屏?How to animate a UIImageview to display fullscreen by tapping on it?(如何通过点击动画 UIImageview 以显示全屏?)
停止 segue 并显示警报To stop segue and show alert(停止 segue 并显示警报)
iOS 5 故事板,以编程方式确定路径iOS 5 storyboard, programmatically determine path(iOS 5 故事板,以编程方式确定路径)
图标已经包含光泽效果Icon already includes gloss effects(图标已经包含光泽效果)
UIEdgeInsetsMake 是如何工作的?How does UIEdgeInsetsMake work?(UIEdgeInsetsMake 是如何工作的?)
UIProgressView 和自定义跟踪和进度图像(iOS 5 属性UIProgressView and Custom Track and Progress Images (iOS 5 properties)(UIProgressView 和自定义跟踪和进度图像(iOS 5 属性))