當我運行我的應用程序時,我收到iAd橫幅視圖的消息。這是什麼意思?iAds不能在模擬器和設備中工作
錯誤域= ADErrorDomain代碼= 3 「的操作無法完成 。廣告資源不可用」 的UserInfo = 0x60455a0 {ADInternalErrorCode = 3,NSLocalizedFailureReason =廣告庫存 不可用}
這是我的代碼:
#pragma mark -
#pragma mark create BannerView:
- (void)createAdBannerView {
Class classAdBannerView = NSClassFromString(@"ADBannerView");
if (classAdBannerView != nil) {
self.adBannerView = [[[classAdBannerView alloc] initWithFrame:CGRectZero] autorelease];
[adBannerView setRequiredContentSizeIdentifiers:[NSSet setWithObjects: ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil]];
if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
[adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
} else {
[adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait];
}
[adBannerView setFrame:CGRectOffset([adBannerView frame], 0, -[self getBannerHeight])];
[adBannerView setDelegate:self];
[self.view addSubview:adBannerView];
}
}
- (void)fixupAdView:(UIInterfaceOrientation)toInterfaceOrientation {
if (adBannerView != nil) {
if (UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) {
[adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierLandscape];
} else {
[adBannerView setCurrentContentSizeIdentifier:ADBannerContentSizeIdentifierPortrait];
}
[UIView beginAnimations:@"fixupViews" context:nil];
if (adBannerViewIsVisible) {
CGRect adBannerViewFrame = [adBannerView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = 0;
[adBannerView setFrame:adBannerViewFrame];
CGRect contentViewFrame = contentView.frame;
contentViewFrame.origin.y = [self getBannerHeight:toInterfaceOrientation];
contentViewFrame.size.height = self.view.frame.size.height - [self getBannerHeight:toInterfaceOrientation];
contentView.frame = contentViewFrame;
} else {
CGRect adBannerViewFrame = [adBannerView frame];
adBannerViewFrame.origin.x = 0;
adBannerViewFrame.origin.y = -[self getBannerHeight:toInterfaceOrientation];
[adBannerView setFrame:adBannerViewFrame];
CGRect contentViewFrame = contentView.frame;
contentViewFrame.origin.y = 0;
contentViewFrame.size.height = self.view.frame.size.height;
contentView.frame = contentViewFrame;
}
[UIView commitAnimations];
}
}
#pragma mark -
#pragma mark ADBannerViewDelegate
- (void)bannerViewDidLoadAd:(ADBannerView *)banner {
if (!adBannerViewIsVisible) {
adBannerViewIsVisible = YES;
[self fixupAdView:[UIDevice currentDevice].orientation];
}
}
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
NSLog(@"the failed error is %@",error);
if (adBannerViewIsVisible)
{
adBannerViewIsVisible = NO;
[self fixupAdView:[UIDevice currentDevice].orientation];
}
//NSLog(@"bannerView:didFailToReceiveAdWithError: %@",[error localizedDescription]);
}
how to solve this problem