問題描述
在我的應(yīng)用程序中,reverseGeocoder 的結(jié)果類似于下面的錯誤塊:
In my application at first time reverseGeocoder results like error block below :
didFailWithError:錯誤Domain=NSURLErrorDomain Code=-1011 "無法執(zhí)行該操作完全的.(NSURLErrorDomain 錯誤 -1011.)UserInfo=0x6252100{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);
}
第一次進入錯誤塊(有時).我有什么遺漏嗎,請幫幫我?
The first time its going to error block (some times). Am I missing any thing please help me out?
推薦答案
Error -1011 is Bad Server Response (來自 apple docs here) 并且 HTTP 狀態(tài)碼是 503(服務(wù)不可用).
Error -1011 is Bad Server Response (from the apple docs here) and the HTTP status code is 503 (Service Unavailable).
所以,我想除非你給他們無效的數(shù)據(jù),否則他們的結(jié)局是個問題!
So, I guess that unless you're giving them invalid data, it's a problem their end!
但是,您可能會考慮檢查一些極端情況:
However, there are a few edge cases that you might consider checking :
(1)坐標的值是多少?如果它無效,那么地理編碼器可能會返回某種錯誤(盡管它可能不應(yīng)該返回 503 ;)
(1) What's the value of coordinate? If it's invalid then the geocoder probably returns some sort of error (though it probably shouldn't return 503 ;)
(2) 您是否支持代理/網(wǎng)絡(luò)身份驗證 - 如果您支持,那么您實際上并不是在與地理編碼服務(wù)對話,而是在與可能無法理解您要做什么的代理對話!
(2) Are you behind a proxy / web authentication - if you are then you're not actually talking to a geocoding service, you're talking to a proxy which probably won't understand what you're trying to do!
這篇關(guān)于第一次 MKReverseGeocoder: didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 {PBHTTPStatusCode=503}的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!