是否可以使用iOS SDK检测LTE连接? [英] Is it possible to detect LTE connection using iOS SDK?
问题描述
我正在使用可访问性API来检测我当前的连接,但我只能区分WIFI和3G。
I'm using the reachability API to detect my current connection, but I can only distinguish between WIFI and 3G.
我得到以下标志:
LTE: kSCNetworkReachabilityFlagsIsLocalAddress | kSCNetworkReachabilityFlagsIsWWAN | kSCNetworkReachabilityFlagsTransientConnection | kSCNetworkReachabilityFlagsReachable
WIFI : kSCNetworkReachabilityFlagsIsDirect | kSCNetworkReachabilityFlagsReachable
问题是LTE返回与3G连接相同的标志。有没有办法确定用户目前是否有LTE或3G?
The problem is that LTE returns the same flags as a 3G connection. Is there any way to determine whether the user currently has LTE or 3G?
推荐答案
从iOS 7开始,你可以找到它使用CoreTelephony框架中 CTTelephonyNetworkInfo
的 currentRadioAccessTechnology
属性。
As of iOS 7, you can find this out using the currentRadioAccessTechnology
property of CTTelephonyNetworkInfo
in the CoreTelephony framework.
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
CTTelephonyNetworkInfo *networkInfo = [CTTelephonyNetworkInfo new];
if ([networkInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) {
// ...
}
这篇关于是否可以使用iOS SDK检测LTE连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!