MKReverseGeocoder位置查找器错误{PBHTTPStatusCode=503}didFailWithErr



Am使用MKReverseGeocoder在iPhone应用程序中查找当前位置。现在有几天应用程序不应该找到当前位置。当我解决问题时,我发现- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error代表发出了以下错误响应。错误消息是,

SourceCache/ProtocolBuffer/ProtocolBuffer-92/Runtime/PBRequester.m:687 server returned error: 503
2012-07-10 12:21:29.773 Dial25[3046:707] didFailWithError:- Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t be completed. (NSURLErrorDomain error -1011.)" UserInfo=0x264090 {PBHTTPStatusCode=503}

我使用了谷歌,找到了在didFailWithError:代表中添加[geoder autorelease];的答案,但我的应用程序仍然找不到当前位置。

-(void)startFindLocationService 
{
    NSLog(@"Starting Location Services");
    CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
    locationManager.distanceFilter = 20.0f;
}
-(void)findAddressByLatLong:(CLLocation *)currentLocation
{
    CLLocationCoordinate2D locationToLookup = currentLocation.coordinate;
    MKReverseGeocoder  *reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:locationToLookup];
    reverseGeocoder.delegate = self;
    [reverseGeocoder start];
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
    NSLog(@"Error: %@", [error description]);
    [geocoder cancel];
    geocoder.delegate = nil;    
    [geocoder autorelease];
}

有人能帮我解决这个问题吗?提前谢谢。

我正在尝试了解更多关于地理编码的信息,并且可能找到了一些其他有用的参考资料。

  1. 自iOS 5以来,一些MKReverseGeocoder类方法已被弃用:http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKReverseGeocoder_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/doc/uid/TP40008323-附录A

  2. 早在2010年,谷歌就出现了问题,只在一天中的特定时间响应MKReverseGeocoder请求。我不知道这是否与你的问题有关,但也许这与苹果公司为什么不赞成这些方法有关。http://blog.aribraginsky.com/2009/12/curious-case-of-mkreversegeocoder.html

  3. 通过切换到CLGeocoder,查看Rohan Kapur对MKReverseGeocoder错误的解决方案:在单例类(ARC)中使用MKReverseGeocoder

希望这能有所帮助!

最新更新