【问题标题】:Xamarin.Essentials Geocoding.PlacemarksAsync throws error in iOS using Xamarin.formsXamarin.Essentials Geocoding.PlacemarksAsync 使用 Xamarin.forms 在 iOS 中引发错误
【发布时间】:2021-07-10 03:38:41
【问题描述】:

我正在使用 Xamarin.Essentials 的 Geocoding.GetPlacemarksAsync(lat, lon) 方法来获取地标。但是当我尝试从 lat long 获取地标时,它会在 iOS 模拟器中引发以下错误。它可以在 Android 模拟器和 android 物理设备中找到。

错误:

NSErrorException Error Domain=kCLErrorDomain code=2 "(null)" at Xamarin.Essentials.GeoCoding.PlatformGetPlacemarksAsync

我在 info.plist 中添加了位置权限。我的项目配置是:

Xamarin.forms:4.5.0.725

Xamarin.Essentials:1.6.1

XCode:12.2

模拟器:iPhone 8+ 14.4

相同的代码在 Android 中运行良好。希望解决

【问题讨论】:

    标签: xamarin xamarin.forms xamarin.android xamarin.ios xamarin-studio


    【解决方案1】:

    你有open and set the location in the simulator吗?

    这可能是网络或地理编码请求的频率问题,您最好检查一下。

    作为

    KCLError 2 为 kCLErrorNetwork,描述为“网络不可用或发生网络错误。”

    CLGeocoder 将限制地理编码请求,如果您超过请求速率,则返回相同的错误。

    您可以参考thisthis页面了解更多详情。

    如果还是不行,你可以在真机上试试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-30
      • 2018-04-27
      相关资源
      最近更新 更多