2012-03-14 106 views
1

的iAd是在iPhone 3GS做工精细有iOS的5.0.1和iPhone 4的iOS为4.3.1工作,但它并没有在iPad 2有工作的iOS 5.0.1。的iAD仅在某些设备上

我收到follwoing错误。

错误域= ADErrorDomain代码= 3 “的操作couldn \ u2019t完成的广告资源不可用”。的UserInfo = 0x118ca00 {ADInternalErrorCode = 3,NSLocalizedFailureReason =广告库存不可用}

下面是代码: -

- (void)createAdView { 
    Class cls = NSClassFromString(@"ADBannerView"); 
    if (cls) { 
     adView = [[cls alloc] initWithFrame:CGRectZero]; 

    adView.requiredContentSizeIdentifiers = [NSSet setWithObjects:ADBannerContentSizeIdentifier320x50, 
              ADBannerContentSizeIdentifier480x32, nil]; 

    // Set the current size based on device orientation 
    adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait; 
    adView.delegate = self; 

    adView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin; 

    // Set intital frame to be offscreen 
    CGRect adFrame = adView.frame; 
    adFrame.origin.y = -44; 
    adView.frame = adFrame; 
    [UIView beginAnimations:@"showBanner" context:NULL]; 
    [self.view addSubview:adView]; 
    [UIView commitAnimations]; 
} 
} 

    //Hides iAd Banner 
- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error { 
if (bannerIsVisible){ 
    [UIView beginAnimations:@"animateAdBannerOff" context:NULL]; 
    adView.frame = CGRectOffset(adView.frame, 0, -44); // Move above screen 
    [UIView commitAnimations]; 
    bannerIsVisible = NO; 
} 
} 

    //Shows iAd Banner. 
    - (void)bannerViewDidLoadAd:(ADBannerView *)banner { 
if (!bannerIsVisible) { 
    [UIView beginAnimations:@"animateAdBannerOn" context:NULL]; 
    adView.frame = CGRectOffset(adView.frame, 0, +44); // Show on top of screen 
    [UIView commitAnimations]; 
    bannerIsVisible = YES; 
} 
    } 


任何帮助,将不胜感激。

回答

0

答案是错误消息给出:广告资源不可用。

这不是代码中的问题,而是Apple没有足够的广告来投放。他们的填充率非常低,所以你必须迎合没有广告可用的情况。许多人使用的服务,如AdWhirl广告回落到其他广告网络,甚至显示为“房子”的广告。

+0

但为什么在同一时间它在iPhone上工作,但在iPad2上发生错误。 – 2012-03-14 11:28:03

+0

因为当iPad的广告请求没有库存。 – 2012-03-14 11:31:16

+0

这是一个设备(iPhone 4)工作正常,但在其他设备(3GS)根本行不通。它总是发生。我测试了很多应用程序。 – 2012-05-18 11:37:19

相关问题