Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. *****Hello everone!
  2.  
  3. I have first time used MKDirection calculateDirectionsWithCompletionHandler to find distance between two locations.
  4. Below is my code:-
  5.  
  6. MKDirections *directions =
  7. [[MKDirections alloc] initWithRequest:request];
  8.  
  9. [directions calculateDirectionsWithCompletionHandler:
  10. ^(MKDirectionsResponse *response, NSError *error) {
  11. if (error) {
  12. NSLog(@"Error is%@",error);
  13.  
  14. // Handle Error
  15. } else {
  16. for (MKRoute *route in response.routes)
  17. {
  18. routeDetails=route;
  19. [self showRoute:response];
  20.  
  21. lblDistance.text=[NSString stringWithFormat:@"%.4f meters",route.distance];
  22.  
  23.  
  24. } }
  25. }];
  26.  
  27.  
  28. I am getting this error for some locations:-
  29. Error Domain=MKErrorDomain Code=5 "Directions Not Available" UserInfo=0x1e3f30b0 {NSLocalizedFailureReason=A route could not be determined between these locations., NSLocalizedDescription=Directions Not Available, MKDirectionsErrorCode=1, MKErrorGEOError=-403}
  30.  
  31. I am not getting the reason why this error is occuring for some locations.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement