【问题标题】:Xamarin.iOS Google Ads TargetingXamarin.iOS 谷歌广告定位
【发布时间】:2016-08-01 07:32:43
【问题描述】:

我想将 Google Ads 集成到我的应用中,但在加载请求和获取广告时遇到了困难。

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

我正在尝试加载 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);

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

这是一个 iOS 应用程序,我正在使用这个组件:https://components.xamarin.com/view/googleiosmobileads

【问题讨论】:

    标签: ios xamarin.ios ads adsense


    【解决方案1】:

    此问题已回答here

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-16
      • 1970-01-01
      • 1970-01-01
      • 2018-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-20
      相关资源
      最近更新 更多