我正在以编程方式在iPhone应用程序中创建ADBannerView

谁能说我

为什么我在控制台中收到此消息,

ADBannerView: Unhandled error (no delegate or delegate does not implement didFailToReceiveAdWithError:): Error Domain=ADErrorDomain Code=3 "The operation couldn’t be completed. Ad inventory unavailable" UserInfo=0xb5328d0 {ADInternalErrorCode=3, NSLocalizedFailureReason=Ad inventory unavailable}

最佳答案

in .h file
#import <iAd/iAd.h>
@interface YOUR_FILE : UIViewController <ADBannerViewDelegate>{

 ADBannerView *adView;
}

@property(nonatomic,retain)IBOutlet ADBannerView *adView;

@end;

在.m文件中
 -(void)viewDidLoad  {

...
...
...
...
     adView.delegate =self;
    }

-(void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
{
    NSLog(@"iAdBanner failed");


}
-(void) bannerViewDidLoadAd:(ADBannerView *)banner
{

    NSLog(@"iAdBanner loaded");



}

关于iphone - 收到ADBannerView错误消息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11573449/

10-12 19:46