
Error Domain=com.Google.ads Code=1 "Request Error: No ad to show." UserInfo=0x14e88e60 {NSLocalizedDescription=Request Error: No ad to show.,NSLocalizedFailureReason=Request Error: No ad to show.} 广告具有自定义尺寸的广告素材(320×125).添加它的UIScrollVIEw是960×125,它被放置为UItableVIEw的标题.
横幅代码:
- (voID)vIEwDIDLoad { [super vIEwDIDLoad]; DFPBannerVIEw *bannerVIEw = (DFPBannerVIEw *)self.vIEw; [self preventBannerCapturetouch:bannerVIEw]; // Create a vIEw of the standard size at the bottom of the screen. // Available AdSize constants are explained in GADAdSize.h. //bannerVIEw = [[DFPBannerVIEw alloc] initWithAdSize:CG]; bannerVIEw.adSize = GADAdSizefromCGSize(CGSizeMake(320,125)); // Specify the ad's "unit IDentifIEr." This is your DFP ad unit ID. bannerVIEw.adUnitID = self.adUnitID; [bannerVIEw setAppEventDelegate:self]; [bannerVIEw setDelegate:self]; bannerVIEw.rootVIEwController = self.bannerOwner; // Initiate a generic request to load it with an ad. GADRequest *request = [[GADRequest alloc] init]; //request.testDevices = [NSArray arrayWithObjects: nil]; [bannerVIEw loadRequest:request]; spinner = [[UIActivityIndicatorVIEw alloc] initWithActivityIndicatorStyle:UIActivityIndicatorVIEwStyleWhite]; spinner.center = CGPointMake(self.vIEw.frame.size.wIDth / 2,self.vIEw.frame.size.height / 2); [self.vIEw addSubvIEw:spinner]; [spinner startAnimating];}- (voID)vIEwDIDAppear:(BOol)animated { [super vIEwDIDAppear:animated];}- (voID)preventBannerCapturetouch:(GADBannerVIEw*)bannerVIEw { for (UIWebVIEw *webVIEw in bannerVIEw.subvIEws) { if ([webVIEw isKindOfClass:[UIWebVIEw class]]) { webVIEw.scrollVIEw.bounces = NO; for (UIGestureRecognizer *gestureRecognizer in webVIEw.gestureRecognizers) { if ([gestureRecognizer isKindOfClass:NSClassFromString(@"GADImpressionTicketGestureRecognizer")]) { gestureRecognizer.delegate = self; } } for (ID vIEw in [[[webVIEw subvIEws] objectAtIndex:0] subvIEws]) { if ([vIEw isKindOfClass:NSClassFromString(@"UIWebbrowserVIEw")]) { for (UIGestureRecognizer *recognizer in [vIEw gestureRecognizers]) { if ([recognizer isKindOfClass:NSClassFromString(@"UIWebtouchEventsGestureRecognizer")]) { [vIEw removeGestureRecognizer:recognizer]; } } return; } } } [webVIEw setTintcolor:[UIcolor whitecolor]]; }}- (voID)vIEwWillUnload { [super vIEwWillUnload]; DFPBannerVIEw *bannerVIEw = (DFPBannerVIEw *)self.vIEw; bannerVIEw.appEventDelegate = nil; bannerVIEw.delegate = nil;}- (voID)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.bannerSlIDer bannertouchesBegan:touches withEvent:event];}- (voID)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [self.bannerSlIDer bannertouchesEnded:touches withEvent:event];}- (voID)adVIEwDIDReceiveAd:(GADBannerVIEw *)bannerVIEw { [spinner stopAnimating];}- (voID)adVIEw:(GADBannerVIEw *)bannerVIEw dIDFailToReceiveADWithError:(GADRequestError *)error { NSLog(@"Google Ad ERROR: %@",error); [spinner stopAnimating];} UIScrollVIEw代码:
- (voID)vIEwDIDLoad { [super vIEwDIDLoad]; UIScrollVIEw *vIEw = (UIScrollVIEw *)self.vIEw; vIEw.bounces = NO; // @"/6499/example/banner" GWBannerController *oneController = [[GWBannerController alloc] initWithNibname:@"BannerVIEw" bundle:nil bannerOwner:self.bannerOwner bannerSlIDer:self ID:@"/XXX/iOSleaderBanner_One"]; //GWBannerController *oneController = [[GWBannerController alloc] initWithNibname:@"BannerVIEw" bundle:nil bannerOwner:self.bannerOwner bannerSlIDer:self ID:@"/6499/example/banner"]; oneController.vIEw.frame = CGRectMake(0,320,125); [vIEw addSubvIEw:oneController.vIEw]; [bannerArray addobject:oneController]; GWBannerController *twoController = [[GWBannerController alloc] initWithNibname:@"BannerVIEw" bundle:nil bannerOwner:self.bannerOwner bannerSlIDer:self ID:@"/XXX/iOSleaderBanner_Two"]; twoController.vIEw.frame = CGRectMake(320,125); [vIEw addSubvIEw:twoController.vIEw]; [bannerArray addobject:twoController]; GWBannerController *threeController = [[GWBannerController alloc] initWithNibname:@"BannerVIEw" bundle:nil bannerOwner:self.bannerOwner bannerSlIDer:self ID:@"/XXX/iOSleaderBanner_Three"]; threeController.vIEw.frame = CGRectMake(640,125); [vIEw addSubvIEw:threeController.vIEw]; [bannerArray addobject:threeController]; [vIEw setContentSize:CGSizeMake(960,125)]; [self startTimer];}解决方法 广告服务器将返回此邮件主要是因为您的广告单元ID没有广告.检查您的广告单元ID是否正确.如果您的横幅宽度/高度为0,您将得到相同的错误.确保您的adUnitID是完美的. 总结 以上是内存溢出为你收集整理的ios – DFP问题:无需展示广告全部内容,希望文章能够帮你解决ios – DFP问题:无需展示广告所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)