我开发了一个Windows phone 8.1应用程序,希望在其中添加Google AdMob广告。我按照此链接中的说明,将GoogleAds.dll添加到我的Windows Phone 8.1引用中,但在工具中未找到AdView控件。我正在使用VS2013 express。
我也尝试了通过C#代码添加广告。
我也尝试了通过C#代码添加广告。
{
AdView bannerAd = new AdView
{
Format = AdFormats.BANNER,
AdUnitID = "MY_AD_UNIT_ID"
};
AdRequest adRequest = new AdRequest();
_mygrid.Children.Add(bannerAd);
bannerAd.LoadAd(adRequest);
}
这里_mygrid是一个表格。我可以将Adview控制器添加到Grid中吗?
当我尝试构建解决方案时,出现以下错误:
错误1:类型“System.Windows.Controls.UserControl”在未被引用的程序集中定义。您必须添加对程序集“System.Windows,版本=2.0.6.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”的引用。c:\users\makot\documents\visual studio 2013\Projects\WC\WC\MainPage.xaml.cs
错误2:最佳的重载方法匹配“Windows.UI.Xaml.Controls.UIElementCollection.Add(Windows.UI.Xaml.UIElement)”具有一些无效的参数。 c:\users\makot\documents\visual studio 2013\Projects\WC\WC\MainPage.xaml.cs
错误3:参数1:无法将“GoogleAds.AdView”转换为“Windows.UI.Xaml.UIElement”。c:\users\makot\documents\visual studio 2013\Projects\WC\WC\MainPage.xaml.cs