AFNetworkReachabilityManager无法检测到活动的Internet连接

时间:2016-10-14 14:14:43

标签: ios objective-c afnetworking-3

我使用AFNetworkReachabilityManager检查互联网连接的状态。 它适用于以下情况:

Wifi is turned 'ON'

Wifi is turned 'OFF'

但当用户为connected to a wifi network without active internet connection时 它仍然会返回状态为“可达”'

 self.manager = [AFNetworkReachabilityManager managerForDomain:@"https://www.google.com"];
[self.manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status)
 {
         if (status == AFNetworkReachabilityStatusNotReachable)
         {
            [weakSelf.statusLabel setText:@"Not Connected"];
        }
        else
        {
            [weakSelf.statusLabel setText:@"Connected"];
        }
}];

0 个答案:

没有答案