允许在UIWebView中进行位置访问 [英] Allowing location access inside UIWebView
问题描述
我有一个基于webview的应用程序,当我访问 http://maps.google.com 时,我的webview没有通过位置像Safari一样。我知道CLLocationManager是必需的,但是当网页(maps.google.com)想要访问我的设备位置时,是否会收到回调?如何使用WebView的网页坐标进行回应?
I have a webview based application and when I access http://maps.google.com, my webview is not passing the location as Safari does. I know CLLocationManager is needed, but do I get a callback when a webpage (maps.google.com) wants access to my device location? How do I respond back with the coordinates to the webpage from my WebView?
推荐答案
webview将自动开始监控位置,但是因为iOS 8的位置访问需要设置info plist中的 NSLocationWhenInUseUsageDescription
描述。
The webview will start monitoring the location automatically, however since iOS 8 location access requires the NSLocationWhenInUseUsageDescription
description in your info plist to be set.
如果已经完成,它会自动提示用户允许进行位置访问。
If this has been done, it will prompt the user automatically to allow location access.
这篇关于允许在UIWebView中进行位置访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!