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)

希望這有助於!