0

In my application at first time reverseGeocoder results like error block below :

didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t 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 its going to error block (some times). Am I missing any thing please help me out?

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
Srinivas
  • 983
  • 9
  • 21
  • possible duplicate of [How to deal with MKReverseGeocoder / PBHTTPStatusCode=503 errors in iOS 4.3?](http://stackoverflow.com/questions/5232822/how-to-deal-with-mkreversegeocoder-pbhttpstatuscode-503-errors-in-ios-4-3) – rckoenes Sep 16 '11 at 10:33
  • i seen that post ...i tried with all solutions given in that post but its working same. – Srinivas Sep 16 '11 at 10:37
  • same here.. any solution?? Thanks – Frade Jan 31 '12 at 16:51

1 Answers1

0

Error -1011 is Bad Server Response (from the apple docs here) and the HTTP status code is 503 (Service Unavailable).

So, I guess that unless you're giving them invalid data, it's a problem their end!

However, there are a few edge cases that you might consider checking :

(1) What's the value of coordinate? If it's invalid then the geocoder probably returns some sort of error (though it probably shouldn't return 503 ;)

(2) Are you behind a proxy / web authentication - if you are then you're not actually talking to a geocoding service, you're talking to a proxy which probably won't understand what you're trying to do!

deanWombourne
  • 38,189
  • 13
  • 98
  • 110
  • in 1) i m checking right coordinate is coming i diidnt get 2nd one – Srinivas Sep 16 '11 at 12:27
  • Are you connected directly to the internet or is there a company proxy in the way? (If you don't know then there probably isn't!) Looks like there is a problem with the geocoding service, you can't do much about that! – deanWombourne Sep 16 '11 at 13:16