首页 > 解决方案 > UWP MapRouteFinder 抛出错误

问题描述

我正在尝试开始使用 UWP MapControl,但特别是 MapRouteFinder。我已经从https://docs.microsoft.com/en-us/windows/uwp/maps-and-location/routes-and-directions尝试了这段代码

        //   Get the route between the points.
        MapRouteFinderResult routeResult =
              await MapRouteFinder.GetDrivingRouteAsync(
              new Geopoint(startLocation),
              new Geopoint(endLocation),
              MapRouteOptimization.Time,
              MapRouteRestrictions.None);

不幸的是,我遇到了一个构建错误:

Severity    Code    Description Project File    Line    Suppression State
Error   CS4036  'IAsyncOperation<MapRouteFinderResult>' does not contain a 
definition for 'GetAwaiter' and no extension method 'GetAwaiter' accepting a 
first argument of type 'IAsyncOperation<MapRouteFinderResult>' could be found 
(are you missing a using directive for 'System'?)   

不确定“系统”缺少什么使用指令?方法。

标签: uwp

解决方案


推荐阅读