MapLocationFinderResult uwp c上的无效凭证#

问题描述:

我在使用MapLocationFinder时遇到了一个奇怪的问题。MapLocationFinderResult uwp c上的无效凭证#

我使用MapLocationFinder基于字符串的地址检索经度和纬度:

string address = ""; // Any address here 

var locFinderResult = await MapLocationFinder.FindLocationsAsync(address, new Geopoint(new BasicGeoposition())); 

在此之后,我用Laucher开始“开车到”应用程序,并得到导航地图:

var geoPos = locFinderResult.Locations[0].Point.Position; 

var url = $"ms-drive-to:?destination.latitude={geoPos.Latitude.ToString(CultureInfo.InvariantCulture)}&destination.longitude={geoPos.Longitude.ToString(CultureInfo.InvariantCulture)}&destination.name={address}"; 
var driveToUri = new Uri(url); 

await Launcher.LaunchUriAsync(driveToUri); 

直到最近,这在所有设备上工作得很好。我不需要任何令牌或任何东西,因为我没有在XAML中实现Map控件。但是,几天前,我开始接收locFinderResult的“InvalidCredentials”响应。它仍然只能在一个设备上工作。我从来没有使用任何凭据,所以我不知道为什么它只适用于这一个。

有谁知道什么可能会导致此问题?

它看起来像从最近一段时间Microsoft要求您从Bing Maps开发人员中心获取密钥以使用此功能。请参阅说明:https://docs.microsoft.com/en-us/windows/uwp/maps-and-location/authentication-key

+0

嗯,它似乎是这样...但它仍然在一个设备上出于某种原因,也许我仍然缺少Windows更新:)。无论如何,这是微软做出的一个可怕的决定,为我们添加更多理由不应该使用他们的平台。 – user2081328

+0

我同意,我的申请也以这种方式被打破。当它在生产中突然中断时非常不愉快:( – Pavel

转至https://www.bingmapsportal.com并创建密钥。然后将其添加到您的应用程序。

MapService.ServiceToken = "MyKey";