0

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

我看到发生以下错误:

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

奇怪的错误,因为我已经实现了 didFailToReceiveAdWithError 的方法,这是我完整的 imp 代码。

- (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;
}
4

1 回答 1

0

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

于 2013-01-27T21:25:14.200 回答