第一次 MKReverseGeocoder: didFailWithError:Error Domain=NSURLEr

at first time MKReverseGeocoder: didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 {PBHTTPStatusCode=503}(第一次 MKReverseGeocoder: didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 {PBHTTPStatusCode=503}) - IT屋-程序员软件
本文介绍了第一次 MKReverseGeocoder: didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 {PBHTTPStatusCode=503}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

在我的应用程序中,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}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Facebook Requests Dialog: Frictionless Requests in native iOS app possible?(Facebook 请求对话框:本机 iOS 应用程序中的无摩擦请求可能吗?)
Difference between iPhone Simulator and Android Emulator(iPhone模拟器和Android模拟器之间的区别)
iOS 6 (iPhone/iPad) Image Upload quot;Request Body Stream Exhaustedquot; with NTLM/Windows Authentication(iOS 6 (iPhone/iPad) 图片上传“请求正文流用尽使用 NTLM/Windows 身份验证)
How to remove Address Bar in Safari in iOS?(如何在 iOS 中删除 Safari 中的地址栏?)
Having trouble creating UIImage from CIImage in iOS5(在 iOS5 中从 CIImage 创建 UIImage 时遇到问题)
Get list of all photo albums and thumbnails for each album(获取所有相册的列表和每个相册的缩略图)