wkwebview与位置服务 [英] wkwebview with location services

查看:179
本文介绍了wkwebview与位置服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试验swift并想尝试wkwebview。
我已经构建了一个应用程序,它一切正常,但问题是我加载到我的wkwebview的网页使用谷歌地图并需要位置服务,所以javascript应该提示一条消息说这个应用程序需要你的位置信息 。
快速的应用程序wkwebview不显示任何消息也不显示我的谷歌地图。如果我使用safari浏览器访问url它会提示位置消息,并且在ios 7上的uiwebview中它会提示该消息。
还有其他人来这个并知道解决方案吗?

Ive been experimenting with swift and wanted to try out the wkwebview. Ive built an app and it all works correctly but the problem is that the webpage that i load into my wkwebview uses google maps and requires location services, so the javascript should prompt a message saying "this app requires your location information". The swift app wkwebview doesnt display any message doesnt display my google maps either. If i visit the url with the safari browser it prompts the location message and also in uiwebview on ios 7 it promps that message. Anyone else come accross this and know a solution?

推荐答案

在iOS 8中,你需要有一个密钥您的 Info.plist 系统可用于提示位置使用情况。在您的情况下,您希望使用键 NSLocationWhenInUseUsageDescription 添加键/值对。该对的值将显示在系统的 first 弹出窗口中,询问您的应用是否可以访问位置服务。然后谷歌地图将被允许弹出自己的警报。

In iOS 8, you need to have a key in your Info.plist that the system can use to prompt for location usage. In your case you want to add a key/value pair with key NSLocationWhenInUseUsageDescription. The value of that pair will be shown in the first popup, from the system, asking if your app can access location services. Then Google Maps will be allowed to pop up its own alert.

这篇关于wkwebview与位置服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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