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.