[英]Flutter iOS webview app with Geolocation website doesn't Ask For Location Permission even info.plist is adjusted
I am trying to make a webview app with a website which needs location permission to use geolocation javascript.我正在尝试使用需要位置权限才能使用地理定位 javascript 的网站制作 webview 应用程序。 I tried something on swift side to enable but unfortunately couldn't manage it.
我在 swift 方面尝试了一些启用但不幸的是无法管理它。 wkwebview-app-doesnt-ask-for-location-permission
wkwebview-app-doesnt-ask-for-location-permission
On flutter side, I have enabled geolocation and javascript by using flutter_webview_plugin I have added same stuff to info.plist.在颤振方面,我通过使用flutter_webview_plugin启用了地理定位和 javascript,我向 info.plist 添加了相同的内容。 What I have to do more to get permission and enable location for website?
我还需要做些什么才能获得许可并为网站启用位置? Thanks in advance
提前致谢
child: WebviewScaffold(
//mediaPlaybackRequiresUserGesture: true,
debuggingEnabled: true,
url: 'https://nakliyemvar.com/isveren/giris.php',
scrollBar: false,
//hidden: true,
withZoom: false,
withJavascript: true,
geolocationEnabled: true,
//withLocalUrl: true,
appCacheEnabled: true,
),
info.plist信息.plist
<key>NSLocationAlwaysUsageDescription</key>
<string>asd</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>asd.</string>
You need to check location authorization status on Swift side and if not determined you need to request it before opening the webview.您需要在 Swift 端检查位置授权状态,如果没有确定,则需要在打开 webview 之前请求它。 Something like this:
像这样的东西:
private func manageLocationPermission() {
let authorizationStatus = CLLocationManager.authorizationStatus()
switch authorizationStatus {
case .notDetermined:
CLLocationManager().requestAlwaysAuthorization()
case .authorizedAlways, .authorizedWhenInUse:
// Open the webview
case .denied:
// Notify the user about it
case .restricted:
break
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.