"InvalidCredentials" UWP 反向地理代码错误 API

"InvalidCredentials" error in UWP reverse geo code API

当我尝试在我的 UWP 应用程序中执行此代码时出现以下错误。我从官方示例中提取了代码:

“InvalidCredentials” error in UWP reverse geo code API

BasicGeoposition location = new BasicGeoposition();
location.Latitude = 47.643;
location.Longitude = -122.131;
Geopoint pointToReverseGeocode = new Geopoint(location);

// Reverse geocode the specified geographic location.
MapLocationFinderResult result = await MapLocationFinder.FindLocationsAtAsync(pointToReverseGeocode);

// If the query returns results, display the name of the town
// contained in the address of the first result.
if (result.Status == MapLocationFinderStatus.Success)
{
    tbOutputText.Text = "town = " + result.Locations[0].Address.Town;
}

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

MapService.ServiceToken = "MyKey";