embedding google maps in UIWebView without asking

2019-08-26 22:09发布

问题:

I'm using google maps loaded in a UIWebView to display direction between 2 locations

here's the url I'm loading in the UIWebView

NSString *routeString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&output=embed",[myData.myLat doubleValue],[myData.myLng doubleValue],[view.annotation coordinate].latitude,[view.annotation coordinate].longitude];

when I remove the output=ember parameter the google panel is displayed but the UIWebView asks for permission to get user location which i already did in my app ,

when I add the output=embed the UIWebView do not ask for location permissions but the google panel is not showing.

How can I prevent the UIWebView from displaying the location permission and in the same time view the google panel ?

thnx

回答1:

answering my own questions . here are the url i used to load the map

NSString *routeString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&view=map&output=html",[myData.myLat doubleValue],[myData.myLng doubleValue],[view.annotation coordinate].latitude,[view.annotation coordinate].longitude];