I'm using the new MKMapItem and all seems fine. When I use "openMapsWithItems" with that options I get the Maps App opened with the route from "plc" to "plc3" but I wanted to use all the 3 Placemarks like Start -> Point --> Destination. Is that possible?
NSMutableArray *arrayMapItem = [[NSMutableArray alloc] init];
MKPlacemark *plc = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(43.77398, 11.248) addressDictionary:nil];
MKMapItem *partenza = [[MKMapItem alloc] initWithPlacemark:plc];
[partenza setName:@"Piazza"];
MKPlacemark *plc2 = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(43.780, 11.248) addressDictionary:nil];
MKMapItem *mezzo = [[MKMapItem alloc] initWithPlacemark:plc2];
[mezzo setName:@"Mezzo"];
MKPlacemark *plc3 = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(43.783, 11.248) addressDictionary:nil];
MKMapItem *destinazione = [[MKMapItem alloc] initWithPlacemark:plc3];
[destinazione setName:@"Destinazione"];
[arrayMapItem addObject:partenza];
[arrayMapItem addObject:mezzo];
[arrayMapItem addObject:destinazione];
NSDictionary* options = [[NSDictionary alloc] initWithObjectsAndKeys:
MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsDirectionsModeKey, nil];
[MKMapItem openMapsWithItems:arrayMapItem launchOptions:options];
From the MapKit documentation, it states:
If you're using the
MKLaunchOptionsDirectionsModeKey
option, you should only pass two items in your array.