【问题标题】:iAd not displaying from last few days前几天 iAd 没有显示
【发布时间】:2013-09-03 10:16:42
【问题描述】:

iAd 错误

    Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" 
UserInfo=0x118bb420 {ADInternalErrorCode=3, ADInternalErrorDomain=ADErrorDomain, NSLocalizedFailureReason=Ad inventory unavailable}

你能告诉我是我的编码问题还是苹果网站的问题?

我在 App Delegate 中分配 iAd 对象,并且代表也在 App Delegate 中。这是代码:-

AppDelegate *appDel=(AppDelegate*)[UIApplication sharedApplication].delegate;
CGRect rect1 = CGRectMake( 0.0,300,320,50);
appDel.adBanner = [[ADBannerView alloc] initWithFrame:rect1];
appDel.adBanner.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifierPortrait];
appDel.adBanner.currentContentSizeIdentifier =      ADBannerContentSizeIdentifierPortrait;
[appDel.adBanner setHidden:YES];
appDel.adBanner.delegate = self;

- (void)bannerViewDidLoadAd:(ADBannerView *)banner
{
    AppDelegate *app=(AppDelegate*)[UIApplication sharedApplication].delegate;
    NSLog(@"iAd load");
    app.adBanner.frame=CGRectMake( 0.0,300,320,50);
    app.adBanner.hidden=NO;
}

- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    AppDelegate *app=(AppDelegate*)[UIApplication sharedApplication].delegate;
    NSLog(@"iAd error: %@", error);
    app.adBanner.hidden=YES;
    app.adBanner.frame=CGRectMake( 0.0,350,0,0);
}

然后我在 Abstract UIViewConroller Class 中添加横幅

CGFloat y=0;
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
    CGSize result = [[UIScreen mainScreen] bounds].size;
    y=result.height;
}
AppDelegate *app=(AppDelegate*)[UIApplication sharedApplication].delegate;
CGRect rect2 = CGRectMake( 0.0,y-50,320,50);
app.adBanner.frame =rect2;
UIViewController *topController = [UIApplication     sharedApplication].keyWindow.rootViewController;
[topController.view addSubview:app.adBanner];

提前感谢您的帮助。

【问题讨论】:

标签: ios iad inventory operation


【解决方案1】:

你是在模拟器上测试吗?当您在 iOS 模拟器中测试 iAd 时,问题可能出在域中。尝试在设备上进行测试,如果问题仍然存在,请添加一些有问题的代码以帮助我们了解实际问题出在哪里

【讨论】:

  • 问题仍然存在,即使在设备上也是如此。我添加了我的代码。谢谢你,如果你能帮助我。
猜你喜欢
  • 2014-04-14
  • 1970-01-01
  • 2020-09-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多