可达性@pd 3.2.0

可达性@pd 3.2.0

测试已测试
语言语言 Obj-CObjective C
许可证 BSD
发布最新发布2016年11月

pd维护。



  • pd

Reachability分叉。添加获取移动网络类型(2G/3G/4G)、移动网络运营商(移动/联通/电信/铁通)的功能

 self.googleReach = [Reachability reachabilityWithHostname:@"www.google.com"];

    self.googleReach.reachableBlock = ^(Reachability * reachability)
    {
        NSString * temp = [NSString stringWithFormat:@"GOOGLE Block Says Reachable(%@)", reachability.currentReachabilityString];
        NSLog(@"%@", temp);

        // to update UI components from a block callback
        // you need to dipatch this to the main thread
        // this uses NSOperationQueue mainQueue
        [[NSOperationQueue mainQueue] addOperationWithBlock:^{
            weakself.blockLabel.text = temp;
            weakself.blockLabel.textColor = [UIColor blackColor];
        }];

        // 4G 3G 2G  WIFI
        NSLog(@"%@",[reachability distinguishReachable]);

        //Mobile Networks Operator
        NSLog(@"%@",[Reachability checkMobileOperators]);
    };