Open card with safari or cards

I need the user to choose whether he wants to open the map using Safari or the map application, but the fact is that I am doing this:

NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&dirflg=d", location.coordinate.latitude, location.coordinate.longitude, destinationLatitude, destinationLongitude]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]]; 

or the same thing:

 [NSString stringWithFormat:@"maps://maps.google.com/maps? 

Both of them open maps (I think this is because Safari is being redirected to maps)

Is there a way to make safari open it?

+4
source share
1 answer

I don’t think you can force Safari to open the maps.google.com URL. Apple's documentation says that Safari will open it if Maps is not available, but otherwise it sends these URLs to Maps. This is not even Safari, which sends the user to Maps, but rather the UIApplication class. You can see the difference if you specify the https protocol - this way it will open Safari and then hit you on Maps.

+1
source

Source: https://habr.com/ru/post/1402658/


All Articles