繁体   English   中英

AdBannerView中的iAd错误

[英]iAd errors in AdBannerView

我有一个仅包含广告的测试应用程序,用于测试设置。 设置为使用admob中介服务,并将iAd和admob广告发送到设备。

我看到发生以下错误:

[AppDeveloper]:ADBannerView:未处理的错误(没有委托或委托未实现didFailToReceiveAdWithError :):错误域= ADErrorDomain代码= 3“无法完成操作。广告资源不可用” UserInfo = 0x9f82850 {ADInternalErrorCode = 3,ADInternalErrorDomain = ADErrorDomain,NSLocalizedFailureReason =广告资源不可用}

我实现了didFailToReceiveAdWithError方法的奇怪错误,这是我的完整展示代码。

- (void)viewDidLoad {
[super viewDidLoad];

// Create a view of the standard size at the top of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = kAdMobPublisherID;

// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];
bannerView_.delegate = self;
bannerView_.backgroundColor = [UIColor blueColor];

GADRequest *request = [GADRequest request];
// Make the request for a test ad. Put in an identifier for
// the simulator as well as any devices you want to receive test ads.
request.testDevices = [NSArray arrayWithObjects:
                       @"4D047EB9-A3A7-441E-989E-C5437F05DB04",
                       @"YOUR_DEVICE_IDENTIFIER",
                       nil];

}

- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error;
{
    NSLog(@"Error - did Fail to Receive an Ad");
    bannerView_.hidden = YES;

}

- (void)adViewDidReceiveAd:(GADBannerView *)view;
{
    NSLog(@"Ad Received");
    bannerView_.hidden = NO;
}

尝试放回return self; 在方法的末尾,以便委托收到错误

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM