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?
Asked
Active
Viewed 3,508 times
1 Answers
9
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.

Nate Cook
- 92,417
- 32
- 217
- 178
-
1I am trying to implement the same thing on iOS 13.3, my app got crash when a user confirms location access on the popup which asked while a tap on "Your location" button of Google map. This works fine with 2 different confirmation popup on safari, but in my app, it asks for default location popup but not the second popup. Please let me know if you have any idea about this. – Vivek Shah Feb 16 '20 at 11:56