当我尝试在我的UWP应用程序中执行此代码时,我收到以下错误。我从官方样本中获取了代码:
UWP反向地理代码API中的“InvalidCredentials”错误
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;
}
答案 0 :(得分:1)
转到https://www.bingmapsportal.com并创建一个密钥。 然后将其添加到您的应用中。
Android SDK Tools : 25.2.2
ios-deploy : 1.8.5
ios-sim : 6.0.0
Node : v6.8.1
npm : 3.10.8
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b