我正在制作地图套件,我有使用UILongPressGestureRecognizer
类更改mapkit位置的任务,我总是成功获得纬度和经度,但我无法获得位置。我这样做。
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc]
initWithTarget:self action:@selector(handleGesture:)];
lpgr.minimumPressDuration = 2.0; //user must press for 2 seconds
[mapView addGestureRecognizer:lpgr];
[lpgr release];
- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer
{
MKPointAnnotation *pa = [[MKPointAnnotation alloc] init];
pa.coordinate = touchMapCoordinate;
temp.latitude= pa.coordinate.latitude;
temp.longitude= pa.coordinate.longitude;
MKReverseGeocoder *reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:pa.coordinate];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
temp.location = ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO);
NSLog(@"original location is %@",temp.location);
}
但是有一段时间我得到了这样的错误
/SourceCache/ProtocolBuffer/ProtocolBuffer-92/Runtime/PBRequester.m:687 服务器返回错误:503 2012-01-02 16:19:36.284 openInvite [303:707] reverseGeocoder:didFailWithError:错误 Domain = NSURLErrorDomain Code = -1011“操作不能 完成。 (NSURLErrorDomain错误-1011。)“UserInfo = 0x124ea0 {PBHTTPStatusCode = 503}
请帮助我。
答案 0 :(得分:1)
HTTP状态代码是线索。
503服务不可用
由于a,服务器当前无法处理请求 临时超载或维护服务器。这意味着 这是一个暂时的条件,一些后会缓解 延迟。如果已知,延迟的长度可以用a表示 Retry-After标头。如果没有给出Retry-After,客户端应该是 像处理500响应那样处理响应。
Note: The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection.
因此,请检查HTTP状态代码以及其503是否再次发送请求。这应该解决问题