iOS RevMob与Admob中介

时间:2013-08-15 19:56:03

标签: ios admob revmob

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

1 个答案:

答案 0 :(得分:1)

我通过将此代码放入调整版本调整大小来纠正此问题,仍需要逻辑来更改旋转高度...但至少我看到了广告。

- (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)];
        }
    }
}