简体   繁体   English

带有地理位置网站的 Flutter iOS webview 应用程序不会请求位置权限,即使 info.plist 已调整

[英]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.

相关问题 即使使用Info.plist中的NSLocationAlwaysUsageDescription和NSLocationWhenInUseUsageDescription,iOS locationmanager也不要求用户许可 - iOS locationmanager doesn't ask user permission even with NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription in Info.plist iOS应用不会要求位置许可 - iOS app doesn't ask for location permission Flutter ios 应用程序提交:Info.plist 中缺少目的字符串 - Flutter ios app submission: Missing Purpose String in Info.plist iOS应用无法读取info.plist - iOS app cannot read info.plist 在 iOS 10 中请求相机和库的权限 - Info.plist - Request Permission for Camera and Library in iOS 10 - Info.plist Info.plist中添加的NSLocationAlwaysUsageDescription字符串未显示在权限弹出窗口ios中 - NSLocationAlwaysUsageDescription string added in info.plist is not showing in permission popup ios 即使我在 info.plist 中添加了 NSCameraUsageDescription,应用程序也会崩溃,使用 iOS 10、Xcode 8 - App crashes even though I added NSCameraUsageDescription in info.plist, using iOS 10, Xcode 8 即使在 info.plist 文件 swift iOS 中添加 NSMicrophoneUsageDescription 后,应用程序也会崩溃 - App crash even after adding NSMicrophoneUsageDescription in info.plist file swift iOS 即使图标位于 Xcode 资产文件夹中,info.plist 文件也不会出现 - info.plist file doesn't appear even though the icons are in the Xcode assets folder iOS后台位置info.plist密钥名称 - IOS background location info.plist key name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM