我正在尝试使用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.");
}

最佳答案

我通过放入此代码来调整介体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)];
        }
    }
}

关于ios - 带有Admob中介的iOS RevMob,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18260715/

10-10 17:11