1. <tfoot id='f7haM'></tfoot>

      <small id='f7haM'></small><noframes id='f7haM'>

      • <bdo id='f7haM'></bdo><ul id='f7haM'></ul>
      <legend id='f7haM'><style id='f7haM'><dir id='f7haM'><q id='f7haM'></q></dir></style></legend>
    2. <i id='f7haM'><tr id='f7haM'><dt id='f7haM'><q id='f7haM'><span id='f7haM'><b id='f7haM'><form id='f7haM'><ins id='f7haM'></ins><ul id='f7haM'></ul><sub id='f7haM'></sub></form><legend id='f7haM'></legend><bdo id='f7haM'><pre id='f7haM'><center id='f7haM'></center></pre></bdo></b><th id='f7haM'></th></span></q></dt></tr></i><div id='f7haM'><tfoot id='f7haM'></tfoot><dl id='f7haM'><fieldset id='f7haM'></fieldset></dl></div>

      检测运营商连接类型(3G/EDGE/GPRS)

      时间:2023-10-04
    3. <tfoot id='z2ixF'></tfoot>
          • <bdo id='z2ixF'></bdo><ul id='z2ixF'></ul>

            1. <small id='z2ixF'></small><noframes id='z2ixF'>

                <i id='z2ixF'><tr id='z2ixF'><dt id='z2ixF'><q id='z2ixF'><span id='z2ixF'><b id='z2ixF'><form id='z2ixF'><ins id='z2ixF'></ins><ul id='z2ixF'></ul><sub id='z2ixF'></sub></form><legend id='z2ixF'></legend><bdo id='z2ixF'><pre id='z2ixF'><center id='z2ixF'></center></pre></bdo></b><th id='z2ixF'></th></span></q></dt></tr></i><div id='z2ixF'><tfoot id='z2ixF'></tfoot><dl id='z2ixF'><fieldset id='z2ixF'></fieldset></dl></div>
              • <legend id='z2ixF'><style id='z2ixF'><dir id='z2ixF'><q id='z2ixF'></q></dir></style></legend>

                  <tbody id='z2ixF'></tbody>
                本文介绍了检测运营商连接类型(3G/EDGE/GPRS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何获取运营商网络的连接类型?

                How can i get the type of connection of a carrier network?

                • 我可以使用 Reachability 类获取连接是 WIFI 还是 WWAN
                • 我可以获取网络标志

                • I'm able to get if connection is WIFI or WWAN using Reachability class
                • I'm able to get network flags

                可达性标志状态:WR t------ localWiFiStatusForFlags

                Reachability Flag Status: WR t------ localWiFiStatusForFlags

              • 我可以使用 CaptiveNetwork

                支持的接口:(en0)

                Supported interfaces: ( en0 )

                en0 => {  
                    BSSID = "xx:xx:xx:xx:xx:xx";  
                    SSID = MyWifiNetwork;  
                    SSIDDATA = <x1x1x1x1 x1x1x1x1 x1>;  
                }  
                

                但我无法区分 3G、EDGE 或 GPRS 连接.

                But i'm not able to differenziate 3G, EDGE or GPRS connection.

                知道也使用 iOS 私有 API 吗?

                谢谢.

                推荐答案

                从iOS 7 开始可以使用:

                From iOS 7 on you can use:

                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 have also found this to detect a slow or fast connection:

                - (BOOL)isFast:(NSString*)radioAccessTechnology {
                    if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS]) {
                        return NO;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge]) {
                        return NO;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyWCDMA]) {
                        return YES;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSDPA]) {
                        return YES;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSUPA]) {
                        return YES;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMA1x]) {
                        return NO;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0]) {
                        return YES;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA]) {
                        return YES;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB]) {
                        return YES;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyeHRPD]) {
                        return YES;
                    } else if ([radioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) {
                        return YES;
                    }
                
                    return YES;
                }
                

                这篇关于检测运营商连接类型(3G/EDGE/GPRS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

              • 上一篇:Android:从软键盘中删除 Enter 键 下一篇:NetworkOnMainThreadException 的快速修复

                相关文章

                <small id='ayOHT'></small><noframes id='ayOHT'>

                <legend id='ayOHT'><style id='ayOHT'><dir id='ayOHT'><q id='ayOHT'></q></dir></style></legend>

                <tfoot id='ayOHT'></tfoot>
                  • <bdo id='ayOHT'></bdo><ul id='ayOHT'></ul>

                    <i id='ayOHT'><tr id='ayOHT'><dt id='ayOHT'><q id='ayOHT'><span id='ayOHT'><b id='ayOHT'><form id='ayOHT'><ins id='ayOHT'></ins><ul id='ayOHT'></ul><sub id='ayOHT'></sub></form><legend id='ayOHT'></legend><bdo id='ayOHT'><pre id='ayOHT'><center id='ayOHT'></center></pre></bdo></b><th id='ayOHT'></th></span></q></dt></tr></i><div id='ayOHT'><tfoot id='ayOHT'></tfoot><dl id='ayOHT'><fieldset id='ayOHT'></fieldset></dl></div>