第一次MKReverseGeocoder:didFailWithError:错误域= NSURLErrorDomain代码= -1011 {PBHTTPStatusCode = 503} [英] at first time MKReverseGeocoder: didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 {PBHTTPStatusCode=503}

查看:126
本文介绍了第一次MKReverseGeocoder:didFailWithError:错误域= NSURLErrorDomain代码= -1011 {PBHTTPStatusCode = 503}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,第一次使用reverseGeocoder结果,如下面的错误块:


didFailWithError:错误
Domain = NSURLErrorDomain Code = -1011操作无法完成
(NSURLErrorDomain错误-1011。)UserInfo = 0x6252100
{PBHTTPStatusCode = 503}


这是我使用的代码:

   - (void)locationManager:(CLLocationManager *)manager (CLLocation *)oldLocation {
$ b 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有消息:@GPS无法跟踪位置,请检查互联网连接。 delegate:self cancelButtonTitle:@OKotherButtonTitles:nil];
[alert show];
[警戒释放];
NSLog(@reverseGeocoder:%@ didFailWithError:%@,geocoder,error);
}

第一次进入错误块(有时)。
我是否缺少任何帮助我的东西?

解决方案

错误-1011是错误的服务器响应(来自< a href =http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/doc/uid/TP40003793-CH3g-SW40这是一个很好的例子,在这里我们可以看到,给他们无效的数据,这是他们结束的问题!



然而,您可能会考虑检查一些边缘情况:



(1)坐标值是多少?如果它是无效的,那么地理编码器可能会返回某种错误(尽管它可能不应该返回503;)

(2)您是否在代理/ Web身份验证之后 - 如果你是那么你实际上没有与地理编码服务交谈,那么你正在与一个代理进行交谈,这可能不会理解你想要做什么!


In my application at first time reverseGeocoder results like error block below :

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

This is the code I used:

- (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 (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) 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) 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:错误域= NSURLErrorDomain代码= -1011 {PBHTTPStatusCode = 503}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆