Google Mobile Ads iOS unable to load SearchRequest RRS feed

  • Question

  • User158525 posted


    I want to integrate Google Ads in my app but im stuck when it's time to load the request and get the Ad. I'm trying to load a SearRequest for displaying a SearchBannerView but not methods seems to match my needs, the LoadRequest methods of the SearchBannerView doesn't accept SearchRequest only Request and no cast exists between those two classes.

    However the google docs says it's possible : https://developers.google.com/mobile-ads-sdk/docs/search-ads-for-apps/ios/

    Here is my code :

    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

    Anyone has succeed to make SearBannerView load something using the Google Ads component of Xamarin ?

    FYI it's for an iOS app and i'm using this component : https://components.xamarin.com/view/googleiosmobileads.

    Monday, February 29, 2016 5:46 PM

All replies

  • User8720 posted

    This is an issue in the binding library.

    When you look the native SDK, classes are declared like this :

    @interface GADRequest : NSObject<NSCopying>
    @interface GADSearchRequest : GADRequest

    But when you look the binding library, you can see this :

    [BaseType(typeof(NSObject), Name="GADRequest")]
    interface Request : INSCopying
    [BaseType(typeof(NSObject), Name="GADSearchRequest")]
    interface SearchRequest

    As you can see, there's a difference in the binding library because the base type of SearchRequest is not Request but NSObject.

    I've downloaded the source code of the binding library, changed the lines as you can see below, recompiled the library and it's working :smiley:

    [BaseType(typeof(NSObject), Name="GADRequest")]
    interface Request : INSCopying
    [BaseType(typeof(Request), Name="GADSearchRequest")]
    interface SearchRequest
    Wednesday, May 18, 2016 2:00 PM
  • User60372 posted

    @EtiennePommier.Dcube @StephaneCordonnier

    Hi guys, thanks for letting know this. I'll continue this thread on GoogleApisForiOSComponents repo:


    Etienne, a big apology for taking some time to give a reply.

    Thanks for helping us to make better components!

    Greetings, Israel Soto.

    Wednesday, May 18, 2016 11:55 PM
  • User158525 posted

    Thanks for the answer @StephaneCordonnier it's working perfectly.

    @IsraelSoto, i hope this fix will be integrated soon :smile:

    Thursday, May 19, 2016 8:25 AM
  • User50596 posted

    Still no release with the fix included. Does also have this bug?

    Monday, June 6, 2016 5:51 PM