0
我有一個代碼來檢測,如果我有互聯網連接或沒有,有時它不工作。下面的代碼:我的代碼,以檢查我是否有互聯網連接不好
-(void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
UIAlertView *alert= [[UIAlertView alloc] initWithTitle:@"Error" message:@"Couldn't connect to the Internet. Please check your connection." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
}
的問題是,有時網絡不加載其他的東西,而不是因爲它有一個不好的連接。我希望有更好的方法來檢查WiFi。任何想法?
Internet conniption,呃? – 2012-02-20 20:00:02
可能重複的[如何檢查iPhone SDK上的活動Internet連接?](http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone -sdk) – 2012-02-20 20:00:25
你可以檢查WiFi連接,甚至主機可達性 - 檢查鏈接喬希給你 – 2012-02-20 20:02:38