2017-06-02 97 views
0

我在使用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」響應。它仍然只能在一個設備上工作。我從來沒有使用任何憑據,所以我不知道爲什麼它只適用於這一個。

有誰知道什麼可能會導致此問題?

回答

1

它看起來像從最近一段時間Microsoft要求您從Bing Maps開發人員中心獲取密鑰以使用此功能。請參閱說明:https://docs.microsoft.com/en-us/windows/uwp/maps-and-location/authentication-key

+0

嗯,它似乎是這樣...但它仍然在一個設備上出於某種原因,也許我仍然缺少Windows更新:)。無論如何,這是微軟做出的一個可怕的決定,爲我們添加更多理由不應該使用他們的平臺。 – user2081328

+0

我同意,我的申請也以這種方式被打破。當它在生產中突然中斷時非常不愉快:( – Pavel