I have implemented the IOS maps “turn by turn” feature on my current application with the current code:
Class itemClass = [MKMapItem class];
if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
MKMapItem *currentLocation = [MKMapItem mapItemForCurrentLocation];
MKMapItem *toLocation = [[MKMapItem alloc] initWithPlacemark:[[MKPlacemark alloc] initWithCoordinate:to addressDictionary:nil]];
toLocation.name = @"Destino";
[MKMapItem openMapsWithItems:[NSArray arrayWithObjects:currentLocation, toLocation, nil]
launchOptions:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:MKLaunchOptionsDirectionsModeDriving, [NSNumber numberWithBool:YES], nil]
forKeys:[NSArray arrayWithObjects:MKLaunchOptionsDirectionsModeKey, MKLaunchOptionsShowsTrafficKey, nil]]];
My question is, how can i return to my app after i use the maps? It was possible with google by using a webView, but i cant make it work on apple maps.
Thanks in advance and sorry for my bad english.
I’m afraid what you’re looking to achieve isn’t possible. You can pass in various launch options when you trigger the maps app (such as which map to use, where to center the map, etc), but what you can’t do is pass a callback to ‘return’ the user back to your when they are done. The user will have to manually navigate back to your app themselves.
You might want to consider filing a feature request with Apple if you think this feature would be particularly worthwhile.