【发布时间】:2023-12-31 14:04:01
【问题描述】:
我目前正在使用 Google AdMob Xamarin 组件(版本 6.12.0 - 请参阅 https://components.xamarin.com/view/googleadmob)在 iOS 应用上显示 DFP 插页式广告和横幅广告(在表格视图中的不同位置显示)。当我在 Visual Studio 2013 中调试时,我得到以下输出:
<Google:HTML> You are currently using version 6.12.0 of the SDK, which doesn't
officially support iOS 8. Please consider updating your SDK to the most recent
sdk version, 6.12.2, to get iOS 8 support, including a fix for smart banner
rendering in landscape mode. The latest SDK can be downloaded from
http://goo.gl/iGzfsP. A full list of release notes is available at
https://developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes.
根据 Xamarin 组件的页面,6.12.0 确实支持 iOS 8。我应该忽略收到的警告吗?如果没有,当组件的最新版本只有 6.12.0 时,我该如何使用 6.12.2?可以继续使用 6.12.0 还是会导致问题?
我注意到横幅广告在 iOS8 上并没有真正显示在正确的位置,它们稍微偏右和偏低。这是因为 SDK 还是 iOS8 中关于单元格显示方式的其他一些变化?
下面是我展示横幅广告的方式:
public void InitialiseBanner(AdMobView property)
{
_bannerViewDelegate = new AdMobBannerViewDelegate();
_bannerView = new DFPBannerView();
float x = (CurrentWidth/2) - (AdvertWidth/2);
_bannerView.RootViewController = this;
_bannerView.BackgroundColor = UIColor.White;
_bannerView.Delegate = _bannerViewDelegate;
_bannerView.Frame = new RectangleF(x, 5, AdvertWidth, 50);
View.Frame = new RectangleF(0, 0, CurrentWidth, 50);
View.AddSubview(_bannerView);
_bannerView.AdUnitID = "/**UNITIDREMOVED**/" + property.AdAlias;
GADRequest request = GADRequest.Request;
.
.
.
_bannerView.LoadRequest(request);
View.BringSubviewToFront(_bannerView);
if (DeviceHelper.IsIos8OrGreater && RespondsToSelector(new Selector("separatorInset")))
{
_bannerView.LayoutMargins = UIEdgeInsets.Zero;
}
}
【问题讨论】:
-
根据文档 (developers.google.com/mobile-ads-sdk/docs/admob/ios/rel-notes),6.12.0 版本实际上支持 iOS 8,但也许他们对支持做了一些更改。 Google AdMob 6.12.2 组件计划在 1 月初发布。
标签: xamarin.ios ios8 xamarin admob google-dfp