Question

I am trying to set up RevMob on AdMob mediation using a CustomEvent.

I have setup the GADCustomEventBanner custom call in my project and everything is being called correctly. But, the ad is black/blank. The only way I can get the ad to show is calling

[[RevMobAds session] showBanner];

Does anyone know how to display the ad view for RevMob ads using AdMob mediation?

#import "RevMobCustomEventBanner.h"

@implementation RevMobCustomEventBanner

// Will be set by the AdMob SDK.
@synthesize delegate = delegate_;

#pragma mark -
#pragma mark GADCustomEventBanner

- (void)requestBannerAd:(GADAdSize)adSize
              parameter:(NSString *)serverParameter
                  label:(NSString *)serverLabel
                request:(GADCustomEventRequest *)customEventRequest  {

    NSLog(@"parameter = %@", serverParameter);
    NSLog(@"label = %@", serverLabel);
    NSLog(@"request = %@", customEventRequest);

    if (!self.revMobBannerView) {
        [RevMobAds startSessionWithAppID:@"XXXXXX"];

        self.revMobBannerView = [[RevMobAds session] bannerView];
        [self.revMobBannerView setDelegate:self];
    }
    [[self revMobBannerView] loadAd];
}

#pragma mark - RevMobAdsDelegate methods

- (void)revmobAdDidReceive {
    NSLog(@"[RevMob Sample App] Ad loaded.");
    [self.delegate customEventBanner:self didReceiveAd:self.revMobBannerView];
}

- (void)revmobAdDidFailWithError:(NSError *)error {
    NSLog(@"[RevMob Sample App] Ad failed: %@", error);
    [self.delegate customEventBanner:self didFailAd:error];
}

- (void)revmobAdDisplayed {
    NSLog(@"[RevMob Sample App] Ad displayed.");
    [self.delegate customEventBanner:self clickDidOccurInAd:self.revMobBannerView];
    [self.delegate customEventBannerWillPresentModal:self];
}

- (void)revmobUserClosedTheAd {
    NSLog(@"[RevMob Sample App] User clicked in the close button.");
    [self.delegate customEventBannerWillDismissModal:self];
}

- (void)revmobUserClickedInTheAd {
    NSLog(@"[RevMob Sample App] User clicked in the Ad.");
}

- (void)installDidReceive {
    NSLog(@"[RevMob Sample App] Install did receive.");
}

- (void)installDidFail {
    NSLog(@"[RevMob Sample App] Install did fail.");
}
Was it helpful?

Solution

I corrected the issue by putting this code in to resize the mediatedAdView, still need logic to change height on rotation...but at lease I am seeing ads.

- (void)adViewDidReceiveAd:(GADBannerView *)adView {
    if ([adView mediatedAdView].frame.size.width == 0.0f) {
        [[adView mediatedAdView] setFrame:CGRectMake(0, 0, adView.frame.size.width, adView.frame.size.height)];
        }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top