2011-09-16 66 views
0

以我在第一次reverseGeocoder結果如下面的差錯塊應用:在第一次MKReverseGeocoder:didFailWithError:錯誤域= NSURLErrorDomain代碼= -1011 {PBHTTPStatusCode = 503}

didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t be completed. (NSURLErrorDomain error -1011.)" UserInfo=0x6252100 {PBHTTPStatusCode=503}

這是我所使用的代碼:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { 

    geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate]; 
    [geocoder setDelegate:self]; 
    [geocoder start]; 
    [locationManager stopUpdatingLocation]; 
} 
-(void)reverseGeocoder:(MKReverseGeocoder *)geocoder1 didFailWithError:(NSError *)error 
{ 
    UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"iBeen There" message:@"GPS can't track the location please check the internet connection." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
    [alert show]; 
    [alert release]; 
    NSLog(@"reverseGeocoder:%@ didFailWithError:%@", geocoder, error); 
} 

它第一次去錯誤塊(有些時候)。 我是否錯過了任何幫助我的東西?

+0

可能重複[如何處理iOS 4.3中的MKReverseGeocoder/PBHTTPStatusCode = 503錯誤?](http://stackoverflow.com/questions/5232822/how-to-deal-with-mkreversegeocoder-pbhttpstatuscode-503-errors -in-ios-4-3) – rckoenes

+0

我看過那篇文章......我嘗試過在該文章中給出的所有解決方案,但其工作原理相同。 – Srinivas

+0

在這裏相同.. 任何解決方案??謝謝 – Frade

回答

0

錯誤-1011是錯誤的服務器響應(來自apple docs here)並且HTTP狀態碼是503(服務不可用)。

所以,我猜,除非你給他們無效的數據,這是他們的結局問題!

然而,也有可能會考慮檢查一些邊緣情況:

(1)什麼是座標的值?如果它是無效的,那麼geocoder可能會返回某種錯誤(雖然它可能不應該返回503;)

(2)你是否在代理/ Web認證 - 如果你是那麼你實際上並沒有說話一個地理編碼服務,你正在與一個代理進行交談,這可能不會理解你想要做什麼!

+0

在1)我檢查正確的座標即將到來我diidnt得到第二個 – Srinivas

+0

你直接連接到互聯網或有一個公司代理的方式嗎? (如果您不知道,那麼可能不存在!)看起來地理編碼服務存在問題,您無法做太多的工作! – deanWombourne

相關問題