Iphone 可达性假阳性
我的可达性代码有误报。当网络可用但未激活时,我收到UIAlert“无互联网连接”。非常感谢您的帮助Iphone 可达性假阳性,iphone,objective-c,xcode,cocoa-touch,reachability,Iphone,Objective C,Xcode,Cocoa Touch,Reachability,我的可达性代码有误报。当网络可用但未激活时,我收到UIAlert“无互联网连接”。非常感谢您的帮助 //Check for Internet Reachability* wifiReach = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain]; NetworkStatus netStatus = [wifiReach currentReachabilityStatus]; switch (netStatus) {
//Check for Internet
Reachability* wifiReach = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
NetworkStatus netStatus = [wifiReach currentReachabilityStatus];
switch (netStatus)
{
case NotReachable:
{
NSLog(@"Access Not Available");
break;
}
case ReachableViaWWAN:
{
NSLog(@"Reachable WWAN");
break;
}
case ReachableViaWiFi:
{
NSLog(@"Reachable WiFi");
break;
}
}
if (netStatus==NotReachable){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Internet Required" message:@"There is no internet connection. Please connect and try again" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}else{
//Push Controller
}
答案与上一个问题相同
可达性有时仅在您的应用程序或以前的某个应用程序尝试连接并等待数据后给出正确答案。因此,您不妨尝试从您的连接中获取数据,因为这可能比询问可达性API更快地为您提供更正确的答案。也许只需要让用户判断一个活动指示器已经旋转了足够长的时间。与上一个问题的答案相同
可达性有时仅在您的应用程序或以前的某个应用程序尝试连接并等待数据后给出正确答案。因此,您不妨尝试从您的连接中获取数据,因为这可能比询问可达性API更快地为您提供更正确的答案。可能只是让用户决定某个活动指示器已经旋转了足够长的时间。这个问题的重复部分不完全相同,您所引用的问题的答案就是不要过多地使用可达性。退房:更多说明detail@stevebay22是什么让你认为那不是正确的答案?这个问题的重复不完全一样,你所引用的问题的答案就是不要太多地使用可达性。退房:更多说明detail@stevebay22是什么让你认为那不是正确的答案?