将Bing地图添加到页面时,Windows应用商店应用程序崩溃

本文关键字:应用 Windows 崩溃 应用程序 地图 Bing 添加 | 更新日期: 2023-09-27 18:24:38

我在VS 2013上创建了新的通用应用程序(Hub Template),并遵循了这篇关于将Bing地图添加到我的应用程序的文章:http://msdn.microsoft.com/en-us/library/hh855146.aspx

my-xaml:

<Page
x:Name="pageRoot"
x:Class="HubApp1.HubPage"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:HubApp1"
xmlns:data="using:HubApp1.Data"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:bm="using:Bing.Maps"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <bm:Map  x:Name="myMap" Credentials="MY_SHARD_KEY" ></bm:Map>
</Grid>

该应用程序在发布时崩溃,本机异常:

Unhandled exception at 0x76ECB152 (combase.dll) in HubApp1.Windows.exe: 0xC000027B: An application-internal exception has occurred (parameters: 0x002ED480, 0x00000002).

没有必应地图的控制,应用程序当然不会崩溃。。。有人知道问题出在哪里吗?我只是想做一些简单的事情。

将Bing地图添加到页面时,Windows应用商店应用程序崩溃

Bing Maps控件仅适用于Windows 8/8.1应用程序。要在通用应用程序中使用地图,请查看此博客文章:http://rbrundritt.wordpress.com/2014/06/24/how-to-make-use-of-maps-in-universal-apps/

另一件需要检查的事情是,您已经在配置管理器中将活动解决方案平台从Any CPU更改为x86或x64。Bing Maps控件使用C++运行时,这要求您在特定平台上构建项目,而不是使用AnyCPU设置。您可以在此处找到相关文档:http://msdn.microsoft.com/en-us/library/dn456475.aspx