gpt4 book ai didi

带有 Admob 中介的 iOS RevMob

转载 作者:行者123 更新时间:2023-11-29 13:07:22 25 4
gpt4 key购买 nike

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

我在我的项目中设置了 GADCustomEventBanner 自定义调用,所有内容都被正确调用。但是,广告是黑色/空白的。我可以让广告显示的唯一方法是调用

[[RevMobAds session] showBanner];

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

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

最佳答案

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

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

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com