如何处理iOS 4.3中的MKReverseGeocoder/PBHTTPStatusCode=503错误?

如何处理iOS 4.3中的MKReverseGeocoder/PBHTTPStatusCode=503错误?,ios,mkreversegeocoder,Ios,Mkreversegeocoder,自从iOS 4.3(GM Seed 10M2518)以来,我在使用MKReverseGeocoder时出现崩溃reverseGeocoder:didFailWithError:被调用时经常出现如下错误: Error Domain=nsurerrordomain code=-1011“操作无法完成。(nsurerrordomain Error-1011。)”UserInfo=0x339900{PBHTTPStatusCode=503} 在这些时刻,应用程序往往会崩溃。 在以前的iOS版本中,情况并

自从iOS 4.3(GM Seed 10M2518)以来,我在使用
MKReverseGeocoder
时出现崩溃
reverseGeocoder:didFailWithError:
被调用时经常出现如下错误:

Error Domain=nsurerrordomain code=-1011“操作无法完成。(nsurerrordomain Error-1011。)”UserInfo=0x339900{PBHTTPStatusCode=503}

在这些时刻,应用程序往往会崩溃。 在以前的iOS版本中,情况并非如此


知道发生了什么吗?

同样的问题,我们检查了各种解决方案,但都不起作用。503响应代码的处理方式与以前的操作系统不同,通过嗅探iPhone流量,您可以很容易地注意到这一点


依赖MKReverseGeocoder的应用程序(如Gowalla)将对苹果造成一定压力。。。因此,我预计这几天会有一个4.3.1修补程序。或谷歌根据苹果的请求更改其SLA。

确保在出现故障时不会过早释放反向地理编码器:


-(void)reverseGeocoder:(MKReverseGeocoder*)geocoder DidfailWitheror:(NSError*)错误更改为
[\u reverseGeocode autorelease]
,为我解决了问题。

根据zippo77的回答,在
-(void)reverseGeocoder:(MKReverseGeocoder*)geocoder didFailWithError:(NSError*)错误中,我首先将MKReverseGeocoder委托设置为nil时发现了最佳结果

_reverseGeocoder.delegate = nil;
[_reverseGeocoder autorelease];

我也有同样的问题,尽管我的
MKReverseGeocoder
代码遵循了苹果的一个示例(
MKReverseGeocoder
作为全局
autorelease
变量)。此外,该问题仅出现在iOS 4.3上(4.0运行时没有问题)


对我来说,解决这个问题的方法是删除
自动释放
部分,并仅在视图的
dealoc
中释放
MKReverseGeocoder

谷歌不允许单个设备在60秒内多次检索其位置,因此在需要时使用另一种方法(http请求,需要JSON)(MKReverseGeocoder*)地理编码器

它在4.3.3(3GS)上对我有效,并连续测试了30-40次检索用户位置,没有崩溃,希望它能有所帮助

- (void) retrieveCurrentLoc {
self.geoCoder =
[[[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate] autorelease];
    geoCoder.delegate = self;

    [geoCoder start];
}

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error{

NSString *fetchURL = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?    q=%@,%@&output=json&sensor=true", [NSString     stringWithFormat:@"%f",mapView.userLocation.location.coordinate.latitude], [NSString      stringWithFormat:@"%f",mapView.userLocation.location.coordinate.longitude]];
    NSURL *url = [NSURL URLWithString:fetchURL];
    NSString *htmlData = [NSString stringWithContentsOfURL:url];

SBJsonParser *parser = [[SBJsonParser alloc] init];
NSDictionary *json = [parser objectWithString:htmlData error:nil];
NSArray *placemark = [json objectForKey:@"Placemark"];
if ([[[[[placemark objectAtIndex:0]     objectForKey:@"AddressDetails"]objectForKey:@"Country"]objectForKey:@"Thoroughfare"]objectFor  Key:@"ThoroughfareName"] != NULL){
    currentAddress = [[[[[placemark objectAtIndex:0]     objectForKey:@"AddressDetails"]objectForKey:@"Country"]objectForKey:@"Thoroughfare"]objectFor  Key:@"ThoroughfareName"];}
else {
    currentAddress = [[placemark objectAtIndex:0] objectForKey:@"address"];
    }
}

可能在geo coder找到placemark之前,您正在停止location manager。请在didFindPlacemark中执行此操作,否则会出现错误

我不会释放geo coder对象,但仍然会出现错误。您可以解释原因吗..此处相同..任何解决方案..谢谢您调用它的次数太多,因此如果pa打包的MKReverseGeocoded不起作用。奇怪的解决方案不是吗?如果您首先执行显式请求,代码会更紧凑。