I'm trying to show routes of two places with Apple's Map.
For the two places, I have both names and coordinates.
MKMapItem *currentLocation = [[MKMapItem alloc]
initWithPlacemark:[[MKPlacemark alloc]
initWithCoordinate:paramModel.fromCoordinate2D
addressDictionary:nil]];
MKMapItem *toLocation = [[MKMapItem alloc]
initWithPlacemark:[[MKPlacemark alloc]
initWithCoordinate:paramModel.toCoordinate2D
addressDictionary:nil]];
return [MKMapItem openMapsWithItems:@[ currentLocation, toLocation ]
launchOptions:@{
MKLaunchOptionsDirectionsModeKey :
MKLaunchOptionsDirectionsModeDriving
}];
The names are stored inside the paramModel
.
I assume this can be achieved by using addressDictionary
? I tried kABPersonAddressStreetKey
and kABPersonAddressCityKey
, but neither will show up in the final route view.