Am using MKReverseGeocoder
to find the current location in my iPhone app. Now a days the app should not find the current locations. When i trouble shoot the problem i have found the following error response from - (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
delegate. The error message is,
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}
I have used Google and found the answer to add [geoder autorelease];
in the didFailWithError:
delegate but still my app should not find the current locations.
-(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];
}
Can anyone please help me to solve the problem? Thanks in advance.
I am attempting to learn more about geocoding myself and may have found some other references that will be helpful.
Several MKReverseGeocoder class methods have been deprecated since iOS 5: http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKReverseGeocoder_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/doc/uid/TP40008323-AppendixA
There were problems back in 2010 with Google only responding to MKReverseGeocoder requests at certain times of day. I do not know if this is relevant to your issue, but perhaps it has something to do with why Apple deprecated the methods. http://blog.aribraginsky.com/2009/12/curious-case-of-mkreversegeocoder.html
See Rohan Kapur's solution to MKReverseGeocoder bugs by switching to CLGeocoder: Using MKReverseGeocoder in a singleton class (ARC)
Hope this helps!