First time MKReverseGeocoder: didFailWithError: Error Domain = NSURLErrorDomain Code = -1011 {PBHTTPStatusCode = 503}

For the first time in my application, reverseGeocoder results appear as an error block below:

didFailWithError: Error Domain = NSURLErrorDomain Code = -1011 "Operation could not be completed. (NSURLErrorDomain error -1011.)" UserInfo = 0x6252100 {PBHTTPStatusCode = 503}

This is the code I used:

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:newLocation.coordinate]; [geocoder setDelegate:self]; [geocoder start]; [locationManager stopUpdatingLocation]; } -(void)reverseGeocoder:(MKReverseGeocoder *)geocoder1 didFailWithError:(NSError *)error { UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"iBeen There" message:@"GPS can't track the location please check the internet connection." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; NSLog(@"reverseGeocoder:%@ didFailWithError:%@", geocoder, error); } 

The first time it goes to the error block (several times). Am I missing something, please help me?

0
iphone geolocation mkreversegeocoder
source share
1 answer

Error -1011 is a bad server response (from apple docs here ), and the HTTP status code is 503 (the service is unavailable).

So, I assume that if you do not give them invalid data, this is the problem of their end!

However, there are a few edge cases you can check:

(1) What is the coordinate value? If it is invalid, the geocoder probably returns some kind of error (although it probably shouldn't return 503;)

(2) You are behind the proxy / website authentication - if you are not talking to the geocoding service then you are talking to a proxy server that probably won’t understand what you are trying to do

0
source

All Articles