0

正在使用MKReverseGeocoder在我的iPhone应用程序中查找当前位置。现在有一天,应用程序不应该找到当前位置。当我遇到问题时,我发现- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error代表出现以下错误。该错误消息是,didFailWithError中的MKReverseGeocoder位置查找程序错误{PBHTTPStatusCode = 503}响应:委托iPhone?

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} 

我用谷歌,找到了答案补充[geoder autorelease];didFailWithError:委托但是我的应用程序不应该查找当前位置。

-(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]; 
} 

任何人都可以请帮我解决这个问题吗?提前致谢。

回答

0

我在尝试了解更多关于自己的地理编码,可能已经找到其他一些有用的参考资料。因为iOS 5的

  1. 几个MKReverseGeocoder类中的方法已过时: http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKReverseGeocoder_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/doc/uid/TP40008323-AppendixA

  2. 有问题,早在2010年与谷歌只回应在一天的某些时间MKReverseGeocoder请求。我不知道这是否与你的问题有关,但也许它与苹果为什么弃用这些方法有关。 http://blog.aribraginsky.com/2009/12/curious-case-of-mkreversegeocoder.html

  3. 见罗汉卡普尔的解决方案通过切换到CLGeocoder到MKReverseGeocoder错误: Using MKReverseGeocoder in a singleton class (ARC)

希望这有助于!