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;
}
}
任何帮助,将不胜感激。
但为什么在同一时间它在iPhone上工作,但在iPad2上发生错误。 – 2012-03-14 11:28:03
因为当iPad的广告请求没有库存。 – 2012-03-14 11:31:16
这是一个设备(iPhone 4)工作正常,但在其他设备(3GS)根本行不通。它总是发生。我测试了很多应用程序。 – 2012-05-18 11:37:19