2012-01-02 1 views
2

Я работаю над набором карт, и у меня есть задача изменить местоположение в mapkit, используя класс UILongPressGestureRecognizer, я всегда получаю широту и долготу, но я не мог получить местоположение некоторое время. Я так делаю.Получение странного выхода в обратном геокодере в iphone dev

UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] 
             initWithTarget:self action:@selector(handleGesture:)]; 
lpgr.minimumPressDuration = 2.0; //user must press for 2 seconds 
[mapView addGestureRecognizer:lpgr]; 
[lpgr release]; 



- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer 
{ 

MKPointAnnotation *pa = [[MKPointAnnotation alloc] init]; 
pa.coordinate = touchMapCoordinate; 
temp.latitude= pa.coordinate.latitude; 
temp.longitude= pa.coordinate.longitude; 
MKReverseGeocoder *reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:pa.coordinate]; 
reverseGeocoder.delegate = self; 
[reverseGeocoder start]; 


} 
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark 
{ 
temp.location = ABCreateStringWithAddressDictionary(placemark.addressDictionary, NO); 
NSLog(@"original location is %@",temp.location); 

} 

Но некоторое время я получил ошибку как этот

/SourceCache/ProtocolBuffer/ProtocolBuffer-92/Runtime/PBRequester.m:687 server returned error: 503 2012-01-02 16:19:36.284 openInvite[303:707] reverseGeocoder: didFailWithError:Error Domain=NSURLErrorDomain Code=-1011 "The operation couldn’t be completed. (NSURLErrorDomain error -1011.)" UserInfo=0x124ea0 {PBHTTPStatusCode=503}

Пожалуйста, помогите мне в этом.

ответ

1

Код статуса HTTP является ключом.

503 Service Unavailable

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

Note: The existence of the 503 status code does not imply that a 
    server must use it when becoming overloaded. Some servers may wish 
    to simply refuse the connection. 

Поэтому проверьте код состояния HTTP, и если его 503 снова отправит запрос. Это должно устранить проблему

+0

это лучший подход, чтобы попробовать снова и снова, потому что я собираюсь загрузить свое приложение на itunes, так как можно решить эту проблему навсегда? – Aleem

+0

Если сервер отказывается от соединения, у вас нет другой возможности попробовать его снова. Конечно, вы не должны делать это бесконечно, так что вы также должны реализовать ограничение на количество запросов. –

+0

hmmm ok, спасибо большое. – Aleem

Смежные вопросы