在我的应用程序中,reverseGeocoder 的结果类似于下面的错误块:
In my application at first time reverseGeocoder results like error block below :
didFailWithError:错误Domain=NSURLErrorDomain Code=-1011 "无法执行该操作完全的.(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 状态码是 503(服务不可用).
Error -1011 is Bad Server Response (from the apple docs here) and the HTTP status code is 503 (Service Unavailable).
所以,我想除非你给他们无效的数据,否则他们的结局是个问题!
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)坐标的值是多少?如果它无效,那么地理编码器可能会返回某种错误(尽管它可能不应该返回 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) 您是否支持代理/网络身份验证 - 如果您支持,那么您实际上并不是在与地理编码服务对话,而是在与可能无法理解您要做什么的代理对话!
(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!
这篇关于第一次 MKReverseGeocoder: didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 {PBHTTPStatusCode=503}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!