Xamarin.iOS Google 广告定位

Xamarin.iOS Google Ads Targeting

我想在我的应用程序中集成 Google 广告,但在加载请求和获取广告时我卡住了。

我需要传递定向参数以加载与我的用户搜索相关的广告。

我正在尝试加载 SearchRequest 以显示 SearchBannerView,但似乎没有任何方法符合我的需要。 SearchBannerViewLoadRequest 方法不接受 SearchRequest。他们只接受 Request 并且在这两个 类.

之间不存在转换

然而,原始 Google 文档说这是可能的:https://developers.google.com/mobile-ads-sdk/docs/search-ads-for-apps/ios/

这是我的代码:

this.banner = new SearchBannerView(AdSizeCons.Banner, new CGPoint(0, 0));
this.banner.TranslatesAutoresizingMaskIntoConstraints = false;
this.banner.AdSize = AdSizeCons.Banner;
this.banner.AdUnitID = this.AdService.AdMobUnitId;
this.banner.AdReceived += this.AdReceived;
this.banner.RootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController;

var request = new SearchRequest();
request.Query = ((GoogleAdViewModel)this.DataContext).Query;

// my request isn't accepted
this.banner.LoadRequest(request);

有没有人使用 Xamarin 的 Google 广告组件成功 SearchBannerView 加载某些内容?

它适用于 iOS 应用,我正在使用此组件:https://components.xamarin.com/view/googleiosmobileads

已回答此问题 here

这是绑定库中的一个问题,类型 SearchRequest 的基类型错误(NSObject 而不是 GADRequest)。