1

我正在尝试使用 CustomEvent 在 AdMob 中介上设置 RevMob。

我已经在我的项目中设置了 GADCustomEventBanner 自定义调用,并且一切都被正确调用。但是,广告是黑色/空白的。我可以让广告展示的唯一方法是打电话

[[RevMobAds session] showBanner];

有谁知道如何使用 AdMob 中介显示 RevMob 广告的广告视图?

#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.");
}
4

1 回答 1

1

我通过放入此代码来调整中介AdView 的大小来纠正这个问题,仍然需要逻辑来改变旋转高度......但至少我看到了广告。

- (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)];
        }
    }
}
于 2013-10-18T16:59:31.723 回答