2011-03-10 19 views
0

我實際上停留在使用Apple的Reachability類的問題上。可達性類「NotReachable」只檢查WIFI連接

我檢查這個互聯網連接:

Reachability *r = [Reachability reachabilityWithHostName:@"http://google.com"]; 
    NetworkStatus internetStatus = [r currentReachabilityStatus]; 

    if (internetStatus == NotReachable){ 

     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Keine Internetverbindung" message:@"Diese Applikation erfordert eine Internetverbindung. Bitte aktivieren Sie diese um die Inhalte korrekt darstellen zu können." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil]; 
     [alert show]; 
     [alert release]; 
    } 
    else { 
     // The stuff if want to do with connection 
    } 

我在模擬器和我的iPhone 4 它工作正常,但僅限於WIFI進行了測試。如果我不在WIFI網絡中,我仍然收到警報消息。有人可以告訴我爲什麼它不檢查iPhone的3G或移動數據網絡連接嗎?

回答