- (void)viewDidLoad
{
[super viewDidLoad];
CLLocationCoordinate2D currentLocation;
currentLocation.latitude = self.mapView.userLocation.location.coordinate.latitude;
currentLocation.longitude = self.mapView.userLocation.location.coordinate.longitude;
CLLocationCoordinate2D otherLocation;
otherLocation.latitude = [lati doubleValue];
otherLocation.longitude = [longi doubleValue];
MKPointAnnotation *mka = [[MKPointAnnotation alloc]init];
mka.Coordinate = otherLocation;
mka.title = @"!";
[self.mapView addAnnotation:mka];
self.mapView.delegate = self;
MKMapPoint *pointsArray = malloc(sizeof(CLLocationCoordinate2D));
pointsArray[0]= MKMapPointForCoordinate(currentLocation);
pointsArray[1]= MKMapPointForCoordinate(otherLocation);
routeLine = [MKPolyline polylineWithPoints:pointsArray count:2];
free(pointsArray);
[self.mapView addOverlay:routeLine];
}
I am using this code to display polyline between to coordinates but i am getting this straight line. How to fix this issue.