The way this works is: you provide a "tel:" URL for your application to open. This calls the Phone application, which automatically starts dialling the provided number. To do this by clicking on an annotation callout, you need to provide a mapView:annotationView:calloutAccessoryControlTapped:
method in your MKMapViewDelegate
.
If, for example, the phone that you wish to dial is the annotation's title, this is how you'd do it:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
NSString *phoneNo = view.annotation.title;
NSString *telString = [NSString stringWithFormat:@"tel:%@", phoneNo];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telString]];
}
In practice, you would also need to check whether the current device is indeed a phone (i.e. not an iPod touch or an iPad). It would also be good to let the user know that they are about to make a phone call, prior to launching the Phone app. E.g. show them an action sheet that allows them to decide whether to make the call or cancel.