I am trying to direct my users to iOS 6 native maps for directions from their current location to a latitude, longitude location as follows:
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:placeLocation addressDictionary:nil];
MKMapItem *destination = [[MKMapItem alloc] initWithPlacemark:placemark];
MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
NSArray *mapItems = @[destination, currentLocation];
NSDictionary *options = @{MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving, MKLaunchOptionsMapTypeKey: [NSNumber numberWithInteger:MKMapTypeStandard], MKLaunchOptionsShowsTrafficKey:@YES};
[MKMapItem openMapsWithItems:mapItems launchOptions:options];
I have set my simulator to my latitude and longitude. What is wrong with my code here?
the code is fine and works for me GIVEN there is a route possible
works when directions between currentLocation and destination can be given.
if currentLocation is in the US, maps fails because it can’t navigate from germany to the us.
but if the currentLocation is in europe too, the maps app works fine 🙂