嵌入谷歌地图在UIWebView没有要求位置权限和显示谷歌面板 [英] embedding google maps in UIWebView without asking for location permissions and showing the google panel

查看:116
本文介绍了嵌入谷歌地图在UIWebView没有要求位置权限和显示谷歌面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在UIWebView中加载的Google地图来显示2个位置之间的方向



这里是我在UIWebView中加载的url

  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]; 

当我移除output = ember参数时,会显示google面板,但UIWebView会请求获取权限用户位置,我已经在我的应用程序,

当我添加输出=嵌入UIWebView不要求位置权限,但谷歌面板不显示。



如何防止UIWebView显示位置权限并同时查看Google面板?



thnx

解决方案

回答我自己的问题。这里是我用来加载地图的url

  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]; 


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

解决方案

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];

这篇关于嵌入谷歌地图在UIWebView没有要求位置权限和显示谷歌面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆