wkwebview with location services

放肆的年华 提交于 2019-12-23 11:46:43

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/26019946/wkwebview-with-location-services

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!