1
我得到了我的可達性代碼的誤報。當網絡可用但未激活時,我得到UIAlert「無互聯網連接」。很感謝任何形式的幫助。可達性錯誤肯定
//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
}
重複這個問題的 http://stackoverflow.com/questions/3086816/reachability-on-iphone-app-with-a-false-positive-will-it-get-past-apple – enbr
不確切地說,你提到的問題的答案是僅僅不使用可達性。檢查出:http://stackoverflow.com/questions/1281232/reachability-sometimes-fails-even-when-we-do-have-an-internet-connection更詳細地解釋 – iOSDevSF
@ stevebay22是什麼讓你覺得那不是沒有正確的答案嗎? – hotpaw2