应用程序的 iOS 位置不如 Android 应用程序具体

问题描述

这可能是一件简单的事情。

我有一个我在 Android 中开发的应用程序,我在其中获取位置以及最终的纬度和经度,这些信息在代码中返回给我,坐标如下所示: 纬度 = 37.7858347 ;经度 = -122.4064172;

但在 iOS 中,我使用 LocationManager 位置并在访问纬度和经度时,它们看起来像这样: 纬度 = 37.785834 ;经度 = -122.406417;

所以你可以看到它是一位数短或不太精确的问题,这听起来可能不是很多,但使我的应用程序在 iOS 中更没用。

有谁知道如何让它像 Android 一样准确?我已经尝试对此进行了大量研究,并将所需的准确度设置为 kCLLocationAccuracyBestForNavigation 以及其他一些选择,但似乎没有任何改变。

以下是来自 iOS 的 2 个相关代码摘录和一张图片,用于查看我在 info.plist 中设置的内容。如果重要的话,我的背景是一位非常有经验的 Java 开发人员,但不熟悉 Swift 和 iOS。 谢谢。

if let currentLocation = locationManager?.location {
    var longitude = currentLocation.coordinate.longitude
    var latitude = currentLocation.coordinate.latitude
    
    print("latitude = \(latitude) ; longitude = \(longitude);");
class ViewController: UIViewController,CLLocationManagerDelegate {
    
    var locationManager: CLLocationManager?
    var currentLocation: CLLocation!
    var gsTask: GSearchAddresstask?
    @IBOutlet var webview: WKWebView!
    let progressBar = Progresstext(text: "Loading")
    let progresstext: UITextView = UITextView()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        webview = WKWebView()
        //webview.navigationDelegate = self
        
        // Get location permission
        locationManager = CLLocationManager()
        locationManager?.delegate = self
        locationManager?.requestWhenInUseAuthorization()
        locationManager?.desiredAccuracy = kCLLocationAccuracyBestForNavigation

Plist(忽略蓝线):

Info.plist file

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)